Get to know MDN better
This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2016.
The invert() CSS function inverts the color samples in the input image. Its result is a <filter-function>.
Specifies the amount of the conversion. A value of 100% is completely inverted, while a value of 0% leaves the input unchanged. Values between 0% and 100% are linear multipliers on the effect. The initial value for interpolation is 0. The default value is 1.
The SVG <feComponentTransfer> filter element can also be used to invert content by creating equivalent inversion on nested <feFuncR>, <feFuncG>, and <feFuncB> table elements. We set the same tableValue for the red, green, and blue filter primitives to the same value, then we can reference the SVG effect by the ID of the <filter>:
The following declarations produce the same effect:
This example shows three images for comparison: an image with an invert() filter function applied, an image with the equivalent SVG function applied, and the original image:
We create an SVG filter that inverts the content on which it is applied by 70%:
We include CSS that will invert elements based on their filter or svgFilter class:
| Filter Effects Module Level 1 # funcdef-filter-invert |
Enable JavaScript to view this browser compatibility table.
The other <filter-function> functions available to be used in values of the filter and backdrop-filter properties include:
This page was last modified on Apr 18, 2026 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.