filter: invert()
Utilities for applying invert filters to an element.
| Class | Styles |
|---|---|
invert | |
filter: invert(100%); |
|
| invert-<number> |
filter: invert(<number>%);
|
| invert-(<custom-property>) |
filter: invert(var(<custom-property>));
|
| invert-[<value>] |
filter: invert(<value>);
|
Use utilities like invert and invert-20 to control the color inversion of an element:
invert-0
invert-20
invert
<img class="invert-0" src="/img/mountains.jpg" /><img class="invert-20" src="/img/mountains.jpg" /><img class="invert" src="/img/mountains.jpg" />
Use the invert-[<value>] syntax to set the color inversion based on a completely custom value:
<img class="invert-[.25] ..." src="/img/mountains.jpg" />
For CSS variables, you can also use the invert-(<custom-property>) syntax:
<img class="invert-(--my-inversion) ..." src="/img/mountains.jpg" />
This is just a shorthand for invert-[var(<custom-property>)] that adds the var() function for you automatically.
Prefix a filter: invert() utility with a breakpoint variant like md: to only apply the utility at medium screen sizes and above:
<img class="invert md:invert-0 ..." src="/img/mountains.jpg" />
Learn more about using variants in the variants documentation.
On this page

5-day mini-course
Build UIs that don’t suck.
Short, tactical video lessons from the creator of Tailwind CSS, delivered directly to your inbox every day for a week.
Copyright © 2026 Tailwind Labs Inc.·Trademark Policy