TExcelTAD
Home › Tailwind CSS › Tailwind Filters

Tailwind Filters

Filters change how an element is rendered: blurring it, brightening it, turning it grey, shifting its colours. Tailwind has two families:

  • Filters (blur-*, grayscale …) affect the element itself.
  • Backdrop filters (backdrop-blur-* …) affect whatever is behind the element — the secret to "frosted glass" panels.

Filter utilities

Class Effect
blur-xs / blur-sm / blur-md / blur-lg / blur-xl / blur-3xl Gaussian blur (4px … 64px)
brightness-50 / brightness-125 darker / brighter
contrast-50 / contrast-150 contrast
grayscale / grayscale-0 remove colour / restore it
sepia old-photo tone
invert invert colours
saturate-0 / saturate-200 colour intensity
hue-rotate-90 / -hue-rotate-60 rotate around the colour wheel
drop-shadow-md / drop-shadow-lg a shadow that follows the shape (great for icons and transparent images)
filter-none remove all filters

Note: As with shadows and radii, v4 renamed the small blurs: v3 blur-sm → v4 blur-xs, v3 blur → v4 blur-sm. The same shift applies to drop-shadow-* and backdrop-blur-*.

html · try it yourself
<!DOCTYPE html>
<html>
<head>
  <script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4.1.11"></script>
</head>
<body class="grid grid-cols-4 gap-3 p-4 text-center text-xs">
  <div><div class="text-5xl">🌻</div>original</div>
  <div><div class="text-5xl blur-xs">🌻</div>blur-xs</div>
  <div><div class="text-5xl grayscale">🌻</div>grayscale</div>
  <div><div class="text-5xl sepia">🌻</div>sepia</div>
  <div><div class="text-5xl invert">🌻</div>invert</div>
  <div><div class="text-5xl hue-rotate-180">🌻</div>hue-rotate-180</div>
  <div><div class="text-5xl brightness-150">🌻</div>brightness-150</div>
  <div><div class="text-5xl saturate-200 contrast-150">🌻</div>saturate+contrast</div>
</body>
</html>

Interactive filters

Filters combine nicely with hover: and transition — a gallery where pictures are grey until you point at them:

html · try it yourself
<!DOCTYPE html>
<html>
<head>
  <script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4.1.11"></script>
</head>
<body class="flex gap-3 p-6">
  <div class="flex size-24 items-center justify-center rounded-xl bg-linear-to-br from-orange-400 to-red-500 text-4xl grayscale transition duration-500 hover:grayscale-0">🦁</div>
  <div class="flex size-24 items-center justify-center rounded-xl bg-linear-to-br from-lime-400 to-green-600 text-4xl grayscale transition duration-500 hover:grayscale-0">🐸</div>
  <div class="flex size-24 items-center justify-center rounded-xl bg-linear-to-br from-sky-400 to-blue-600 text-4xl grayscale transition duration-500 hover:grayscale-0">🐳</div>
</body>
</html>

Drop shadow vs box shadow

shadow-* always draws a rectangle (following border-radius). drop-shadow-* follows the actual visible shape, so it hugs SVG icons, emoji and transparent PNGs.

html · try it yourself
<!DOCTYPE html>
<html>
<head>
  <script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4.1.11"></script>
</head>
<body class="flex items-center gap-12 bg-sky-50 p-8">
  <svg viewBox="0 0 24 24" class="size-20 fill-amber-400 shadow-xl"><path d="M12 2l3 7h7l-5.5 4.5L18 21l-6-4-6 4 1.5-7.5L2 9h7z"/></svg>
  <svg viewBox="0 0 24 24" class="size-20 fill-amber-400 drop-shadow-xl"><path d="M12 2l3 7h7l-5.5 4.5L18 21l-6-4-6 4 1.5-7.5L2 9h7z"/></svg>
  <svg viewBox="0 0 24 24" class="size-20 fill-amber-400 drop-shadow-lg drop-shadow-amber-600/60"><path d="M12 2l3 7h7l-5.5 4.5L18 21l-6-4-6 4 1.5-7.5L2 9h7z"/></svg>
</body>
</html>

The first star gets a rectangular shadow-xl; the other two use drop-shadow, which follows the star. Since v4.1 drop shadows can be coloured, like the third star.

Backdrop filters: frosted glass

Backdrop utilities have the same names with a backdrop- prefix: backdrop-blur-md, backdrop-brightness-125, backdrop-grayscale … They only show an effect if the element's own background is at least partly transparent.

html · try it yourself
<!DOCTYPE html>
<html>
<head>
  <script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4.1.11"></script>
</head>
<body class="relative flex min-h-screen items-center justify-center overflow-hidden bg-slate-900 p-6">
  <div class="absolute top-6 left-10 size-32 rounded-full bg-fuchsia-500"></div>
  <div class="absolute right-12 bottom-6 size-40 rounded-full bg-cyan-400"></div>
  <div class="absolute top-20 right-1/3 size-20 rounded-full bg-amber-300"></div>
  <div class="relative w-64 rounded-2xl border border-white/20 bg-white/10 p-5 text-white shadow-xl backdrop-blur-md">
    <p class="font-semibold">Frosted glass</p>
    <p class="mt-1 text-sm text-white/80">bg-white/10 + backdrop-blur-md + a faint border.</p>
  </div>
</body>
</html>

Tip: Glass effects need contrast behind them. Over a plain white page, backdrop-blur is invisible — use it over colourful backgrounds, images or sticky headers above scrolling content.

Test yourself

Which utility blurs what is *behind* an element?

  1. blur-md
  2. backdrop-blur-md
  3. bg-blur-md
  4. filter-blur

Why use drop-shadow-lg instead of shadow-lg on an SVG icon?

  1. It is faster to type
  2. It follows the icon's actual shape instead of drawing a rectangle
  3. shadow-lg doesn't work on SVG
  4. It adds a coloured outline

A frosted-glass card shows no blur. What is the most likely cause?

  1. The card's background is fully opaque
  2. The card is missing relative
  3. backdrop-blur needs grayscale
  4. Tailwind v4 removed backdrop filters