CSS Mask Image Generator

Fade image edges and add spotlight or vignette masks with pure CSS.

Free CSS mask-image generator. Create edge fades, spotlight and vignette masks with an adjustable falloff, preview them live on a sample tile, and copy a cross-browser mask-image plus -webkit-mask-image declaration. Runs in your browser. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

What does mask-image do in CSS?

mask-image uses the alpha (or luminance) of a gradient or image to control which parts of an element are visible. Where the mask is opaque black the element shows fully; where it is transparent the element is hidden. A gradient mask therefore creates a smooth fade.

mask-image lets you fade an element’s edges or punch a soft spotlight into it using nothing but a CSS gradient — no Photoshop, no PNG masks. This generator builds the common masks and copies a cross-browser declaration.

Mask styles

StyleEffect
Fade bottom / topImage dissolves into the page along one edge
Fade top + bottomBoth horizontal edges fade — good for scroll areas
Fade left + rightVertical edges fade — good for carousels
SpotlightCentre stays solid, edges fade to nothing
VignetteCentre fades out, edges stay — inverse spotlight

The output

-webkit-mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
        mask-image: linear-gradient(to bottom, black 80%, transparent 100%);

The falloff slider moves the colour stops so you control how gradual the transition is. The -webkit- prefixed line is included because Safari still needs it.

Because the mask is a gradient, it adds no image files and the underlying element is never modified — the effect is applied purely at render time. The live preview and generation run in your browser.