Guide

Glassmorphism in CSS: blur, contrast and fallbacks

Reviewed 23 November 2026 · 7 min read · Written and maintained by Toolnexo

Glassmorphism is the frosted-glass look: a translucent panel that blurs whatever sits behind it. It is easy to make and just as easy to make unreadable. This guide shows the four ingredients, then does the part most tutorials skip, which is checking the contrast of text on the glass with real numbers. The CSS comes from the glassmorphism generator on this site, which runs in your browser, so nothing you build is uploaded.

The four ingredients

  • A translucent background, such as background: rgba(255, 255, 255, 0.2). It lets the scene show through.
  • A backdrop-filter, such as blur(12px) saturate(150%). It blurs and boosts the colours of whatever is behind the element.
  • A thin light border, such as 1px solid rgba(255, 255, 255, 0.3), which suggests the edge of a pane of glass.
  • A soft shadow, such as box-shadow: 0 8px 32px rgba(31, 38, 135, 0.2), which lifts the panel off the page.

backdrop-filter is not filter

filter: blur() blurs the element itself and everything inside it, text included. backdrop-filter blurs only the area behind the element and leaves the content sharp. That is what makes frosted glass possible. The tool writes the filter twice, once with the -webkit- prefix, because some Safari versions need the prefixed name. Browsers that understand the plain name use it and ignore the other line.

The effect needs something behind the panel to blur. Over a flat colour a glass panel looks like a plain tinted box, so use it over images, gradients or shapes. It also fails if a parent element has its own opaque background between the panel and the scene.

Checking the contrast of text on glass

Text is only readable if it contrasts enough with what is under it, and under glass that is a mix of your fill and the blurred scene. The figures below use the WCAG contrast ratio, where 4.5 to 1 is the usual minimum for normal text and 3 to 1 for large text. They treat the scene as one flat colour, which is the best case, since a blurred photo varies from place to place.

Take a pink scene, #ec4899. White text directly on it has a ratio of 3.53, and dark text (#0f172a) has 5.06. Put a white fill at 20 percent over it and the panel becomes #f06dad. White text on that drops to 2.80, which fails even the large-text minimum, because the white fill moved the background towards the text colour. Switch to a dark fill, #0f172a at 45 percent, and the panel becomes #893267. White text on that scores 7.73, which clears the 7 to 1 level as well.

Over a light amber scene, #f59e0b, a 20 percent white fill gives #f7b13c. White text scores 1.86 and dark text 9.61. Raising the white fill to 80 percent gives #fdecce, where dark text scores 15.36. The lesson is to match the text colour to the fill: light fills want dark text, dark fills want light text, and weak fills over busy scenes want neither.

Fallbacks for browsers without support

backdrop-filter works in the current versions of the major browsers, but if it is missing the page still shows your translucent fill with no blur. Make sure the fill alone is readable, or add a more solid fallback and let supporting browsers override it: set an opaque background first, then inside @supports (backdrop-filter: blur(1px)) switch to the translucent one. Test with the filter turned off, not only with it on.

Keep it cheap

  • Blur is the costly part. Large blurred areas, or many glass elements on one screen, can make scrolling and animation heavier on older and low-power devices.
  • Use it on cards, navigation bars and dialogs, not on a panel the size of the page.
  • A smaller blur radius is cheaper, and 8 to 16 pixels already looks frosted.
  • Avoid animating the blur value itself. Fade or move the panel instead.

Using the generator

  • Pick a preset, such as Frosted light or Smoked dark, then adjust the blur, saturation, fill colour and opacity, border opacity and radius.
  • Watch the card over the colourful scene, then copy the CSS.
  • Check your real text against your real background with the colour contrast checker before you ship.
Tools in this guide

Put it into practice

How this guide is maintained

This page is reviewed when the related tools change. It describes what the published tools actually do: the tools run in your browser tab, so your files stay on your device. If you find something inaccurate, email [email protected] and it will be corrected.

Keep reading

Other guides

All guides →