Six ready-made shapes
Circle, ellipse, star, diagonal, radial fade and edge fade cover the most common masking needs out of the box.
Try circle, star and fade mask-image presets, tune size, position and repeat, and preview the result on a gradient or your own image.
Build soft fades and clean shapes with mask-image, no image editor required.
Circle, ellipse, star, diagonal, radial fade and edge fade cover the most common masking needs out of the box.
Use the 9-point grid to anchor the mask exactly where you want it, plus a size scale and repeat toggle.
Upload a photo to see precisely how the mask will crop it before you ship the CSS.
The CSS mask-image property hides parts of an element based on the alpha channel of a gradient or image, letting you cut soft fades and complex shapes into any box without touching the underlying artwork. Where the mask is fully opaque, the element shows through normally; where the mask is fully transparent, the element is hidden; and anywhere in between produces a partial, gradual reveal — something a hard-edged property like clip-path simply cannot do on its own. Masks accept the same value types as background-image, including CSS gradients, raster images and SVG data URIs, and they support companion properties like mask-size, mask-position and mask-repeat that behave almost identically to their background-* counterparts. Browser support is solid in Chromium and Firefox, but Safari and some older WebKit browsers still require the -webkit-mask-* prefixed versions, so production CSS should always include both forms together, exactly as this generator's output does. Because the effect is computed per pixel from the mask source, very large or animated masks can be more GPU-intensive than a simple background, so it's worth testing performance on the actual elements you plan to mask.
Use a linear or radial gradient as the mask source whenever you want a gradual fade instead of a hard cutoff.
An inline SVG data URI can mask an element into any arbitrary shape, like the star preset in this tool.
Ship -webkit-mask-image alongside mask-image so Safari renders the same result.
Reach for clip-path for hard geometric edges, and mask-image when you need gradients or transparency data.
mask-image uses the alpha channel of an image or gradient to control which parts of an element are visible, hiding areas that align with transparent regions of the mask.
Yes, for broader compatibility. Safari and some older WebKit-based browsers require the -webkit- prefixed versions of mask properties alongside the unprefixed ones.
clip-path defines a hard geometric boundary, while mask-image can use soft gradients and image alpha data, making gradual fades and complex shapes possible that clip-path cannot produce alone.
Yes. Upload any image and it becomes the masked element's background so you can preview exactly how the mask will crop your artwork.
Yes, it's completely free, requires no account, and the CSS is generated locally in your browser.
Keep building polished interfaces with these free online CSS generators.