Testing

CSS Masks: Browser Support, Properties, Known Issues

CSS Masks works in Chrome 120+, Edge 120+, Firefox 53+, Safari 15.4+, Opera 106+, and Samsung Internet 25+. See full browser support and known issues.

Author

Prince Dewani

May 1, 2026

CSS Masks is a W3C feature from the CSS Masking Module Level 1 that hides part of an element using an image, gradient, or SVG mask. It works unprefixed in Chrome 120+, Edge 120+, Firefox 53+, Safari 15.4+, Opera 106+, and Samsung Internet 25+, while older builds need the -webkit- prefix and Internet Explorer never added support.

This guide covers what CSS Masks are, the browsers that support them, the mask properties, how to use them, and the known issues.

What are CSS Masks?

CSS Masks are a W3C feature from the CSS Masking Module Level 1 that hides part of an element through the alpha or luminance channel of a mask source. The mask shorthand and its longhands accept PNG images, SVG mask elements, and CSS gradients as that source.

Which browsers support CSS Masks?

Every modern desktop and mobile browser supports the unprefixed mask property, while older Chromium, Safari, and Samsung Internet builds need the -webkit-mask-image prefix and Internet Explorer never added support. Global coverage reaches roughly 96% when partial, prefixed support is counted.

Loading browser compatibility data...

CSS Masks compatibility in Chrome

Chrome supports the unprefixed mask property from Chrome 120 on Windows, macOS, Linux, ChromeOS, and Android. Chrome 4 through 119 supported masking only through the -webkit-mask-image prefix and a subset of mask longhands. Pair every mask declaration with -webkit-mask-image to cover the partial-support window.

CSS Masks compatibility in Edge

Microsoft Edge supports the unprefixed mask property from Edge 120 on Windows, macOS, Linux, and Android. Chromium-based Edge 79 through 119 only accepted -webkit-mask-image, and the legacy EdgeHTML builds 12 through 18 had no support at all. Chromium Edge tracks Chrome exactly, so the same prefixed fallback applies.

CSS Masks compatibility in Firefox

Firefox supports the unprefixed mask property from Firefox 53 on Windows, macOS, Linux, and Android. Firefox 3.5 through 52 supported the older SVG-based mask spec only, accepting mask: url(#id) for inline SVG masks but not gradient or image sources. Firefox does not need the -webkit- prefix at any version.

CSS Masks compatibility in Safari

Safari supports the unprefixed mask property from Safari 15.4 on macOS and Safari on iOS 15.4 on iPhone and iPad. Safari 4 through 15.3 and Safari on iOS 3.2 through 15.3 supported masking only through -webkit-mask-image, the original WebKit prefix that shipped before the W3C spec. Always pair the prefixed and unprefixed declarations for older Apple devices.

CSS Masks compatibility in Opera

Opera supports the unprefixed mask property from Opera 106 on Windows, macOS, Linux, and Android. Opera 15 through 105, which switched to the Blink engine, accepted the -webkit-mask-image prefix only. Opera Mini, which renders pages on a remote server, has no mask support at any version and falls back to the unmasked element.

CSS Masks compatibility in Samsung Internet

Samsung Internet supports the unprefixed mask property from Samsung Internet 25 on Galaxy phones and tablets. Samsung Internet 4 through 24 only accepted -webkit-mask-image because those builds tracked an older Chromium baseline. Every release from version 25 forward inherits Chrome on Android behavior.

CSS Masks compatibility in Android Browser

The legacy Android Browser shipped on Android 2.1 through 4.4.4 supported masking only through -webkit-mask-image. Modern Android Browser builds running on Chromium 120 and later inherit the unprefixed mask property from the system WebView. Apps that embed Android WebView pick up unprefixed mask once the WebView updates past the Chromium 120 baseline.

CSS Masks compatibility in Internet Explorer

Internet Explorer 5.5 through 11 do not support any of the CSS mask properties. The Trident engine never received the CSS Masking module and silently ignores the rule. Microsoft has retired Internet Explorer 11, so users on supported Windows builds run Microsoft Edge, which supports the unprefixed mask property from Edge 120 forward.

Note

Note: CSS Masks render differently across older Blink, WebKit, and Samsung Internet builds. Test it on real browsers and OS with TestMu AI. Try TestMu AI free!

What are the key CSS mask properties?

The mask shorthand rolls up eight longhand properties from the CSS Masking Module Level 1. Setting the shorthand resets every longhand it covers, so reach for the longhand when you only want to change one piece.

  • mask-image: Sets the source of the mask. Accepts a url() to a PNG or SVG file, a url(#id) to an inline SVG mask element, or a CSS gradient like linear-gradient() or radial-gradient().
  • mask-mode: Picks how the source is read, with values alpha, luminance, or match-source. Alpha uses transparency to hide and reveal; luminance uses brightness, which matches legacy SVG mask behavior.
  • mask-clip: Defines the painting area for the mask, with values border-box, padding-box, content-box, fill-box, stroke-box, view-box, or no-clip.
  • mask-origin: Sets the origin point the mask is positioned from, using the same box-keyword values as mask-clip.
  • mask-size: Sizes the mask source, with values auto, contain, cover, or explicit length and percentage values.
  • mask-repeat: Controls tiling, with values repeat, repeat-x, repeat-y, space, round, or no-repeat.
  • mask-position: Places the mask source inside the origin box, with the same syntax as background-position.
  • mask-composite: Combines stacked masks, with values add, subtract, intersect, and exclude. Use it when you pass multiple comma-separated mask images and want them to interact.

A separate mask-border shorthand and its longhands cover image-based border masks, but support for mask-border lags behind the main mask property and currently ships only in WebKit and Firefox.

How do you use CSS Masks?

Pick a mask source, point mask-image at it, and pair the unprefixed declaration with the -webkit-mask-image fallback. The steps below cover the common image, gradient, and SVG patterns in one pass.

  • Pick a mask source: Decide between a raster image (PNG with transparent regions), a CSS gradient (linear, radial, or conic), or an inline SVG mask element referenced by id.
  • Set mask-image with the prefix: Write -webkit-mask-image first, then mask-image right below with the same value, so older Blink and WebKit builds still match the rule.
  • Control sizing and tiling: Add mask-size: contain or mask-size: cover to fit the source to the element, and mask-repeat: no-repeat unless you want the source tiled.
  • Switch mask-mode if needed: Leave mask-mode at match-source for most cases. Set mask-mode: alpha for PNGs that rely on transparency or mask-mode: luminance for grayscale luminance masks.
  • Test the prefixed and unprefixed paths: Open the page in Chrome 120+, Safari 15.4+, and one older Safari or Samsung Internet build to confirm both code paths render the mask correctly.
/* Use a PNG or SVG image as the mask source. */
.image {
    -webkit-mask-image: url(shape.svg);
            mask-image: url(shape.svg);
    -webkit-mask-size: contain;
            mask-size: contain;
    -webkit-mask-repeat: no-repeat;
            mask-repeat: no-repeat;
}

/* Fade the bottom of an image with a CSS gradient. */
.fade {
    -webkit-mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
            mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
}

/* Reference an inline SVG <mask> element by its id. */
.svg-mask {
    -webkit-mask-image: url(#star);
            mask-image: url(#star);
    -webkit-mask-mode: alpha;
            mask-mode: alpha;
}

The three rules above cover image, gradient, and inline-SVG mask sources. Drop them into a stylesheet, attach the matching class to an element with visible content, and the mask appears on every browser that supports either the prefixed or unprefixed declaration.

...

What are the known issues with CSS Masks?

CSS Masks have a few sharp edges that show up only when you ship to production across browsers. Plan around these before you replace static PNG cutouts with a mask rule.

  • The -webkit-mask-image prefix is still required for older Blink and WebKit: Chrome 4 to 119, Edge 79 to 119, Safari 4 to 15.3, and Samsung Internet 4 to 24 only recognize the prefixed property. Drop the prefix and the mask disappears on every device that has not updated past those builds.
  • mask-composite values differ between Blink and WebKit: WebKit historically used keywords like source-over, source-in, and source-out, while the W3C spec and Blink ship add, subtract, intersect, and exclude. Use the spec keywords on Chrome 120+ and Safari 15.4+, and fall back to the WebKit keywords for the prefixed -webkit-mask-composite path.
  • SVG mask references behave differently from image and gradient masks: Firefox accepts mask: url(#id) all the way back to Firefox 3.5, but image and gradient sources only work from Firefox 53. If your mask source is an inline SVG mask element, you get broader Firefox coverage than image or gradient masks.
  • mask-mode default changed across versions: Older WebKit builds default to alpha masking, while Firefox and current spec implementations default to match-source. Set mask-mode explicitly when you need consistent behavior, especially for SVG mask sources where match-source resolves to luminance.
  • The mask-border shorthand lags the main mask: Only Safari and Firefox ship parts of mask-border under the unprefixed name. Treat mask-border as progressive enhancement and avoid it on Blink-only flows.
  • In my experience, the prefix gap catches more teams than any other mask quirk: a polished mask design ships, looks perfect in current Chrome and Safari, and silently drops on a two-year-old iPhone or Galaxy because the unprefixed declaration is the only one in the stylesheet, so always include both lines and run the page through a real Safari 15 device before release.
...

Citations

All CSS Masks version numbers and platform notes in this guide come from these primary sources:

Author

Prince Dewani is a Community Contributor at TestMu AI, where he manages content strategies around software testing, QA, and test automation. He is certified in Selenium, Cypress, Playwright, Appium, Automation Testing, and KaneAI. Prince has also presented academic research at the international conference PBCON-01. He further specializes in on-page SEO, bridging marketing with core testing technologies. On LinkedIn, he is followed by 4,300+ QA engineers, developers, DevOps experts, tech leaders, and AI-focused practitioners in the global testing community.

Open in ChatGPT Icon

Open in ChatGPT

Open in Claude Icon

Open in Claude

Open in Perplexity Icon

Open in Perplexity

Open in Grok Icon

Open in Grok

Open in Gemini AI Icon

Open in Gemini AI

Copied to Clipboard!
...

3000+ Browsers. One Platform.

See exactly how your site performs everywhere.

Try it free
...

Write Tests in Plain English with KaneAI

Create, debug, and evolve tests using natural language.

Try for free

Frequently asked questions

Did you find this page helpful?

More Related Hubs

TestMu AI forEnterprise

Get access to solutions built on Enterprise
grade security, privacy, & compliance

  • Advanced access controls
  • Advanced data retention rules
  • Advanced Local Testing
  • Premium Support options
  • Early access to beta features
  • Private Slack Channel
  • Unlimited Manual Accessibility DevTools Tests