Glassmorphism Generator
Create frosted-glass cards with live preview and copy-ready CSS.
Dial in blur, opacity, tint and border on a live frosted-glass card over a gradient you control, then copy backdrop-filter CSS that just works. Free. No sign-up. Runs in your browser, nothing is uploaded.
backdrop-filter is supported in all current browsers; the -webkit- prefix is included for older Safari. Always provide a readable fallback background for browsers that ignore it.
background: rgba(255, 255, 255, 0.18);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
border: 1px solid rgba(255, 255, 255, 0.35);
border-radius: 18px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);Adjust blur, background opacity, tint, border and corner radius on a glass card floating over a gradient you choose, then copy six lines of CSS. The two background colours are only there for the preview: set them to resemble the photo or gradient your real card will sit on, so you judge the effect against what users will actually see.
The CSS, line by line
With the default settings, the copy button gives you:
background: rgba(255, 255, 255, 0.18);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
border: 1px solid rgba(255, 255, 255, 0.35);
border-radius: 18px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
| Line | Control | What it does |
|---|---|---|
background: rgba(…) | Glass tint + Background opacity (0–100%) | Tints the pane; the alpha decides how much of the blurred scene shows through |
backdrop-filter: blur() | Blur (0–40 px) | Blurs everything rendered behind the element, not the element itself |
-webkit-backdrop-filter | same | The prefixed form for older Safari |
border | Border visibility (0–100%) | A 1 px white edge at the chosen alpha — the "rim" that makes it read as glass |
border-radius | Corner radius (0–48 px) | Shape |
box-shadow | fixed | A soft drop shadow that lifts the pane; tune it separately with the Box-Shadow Generator |
Starting points that tend to work: 8–16 px blur for cards, 10–25% alpha for a white tint on a vivid background, 20–40% border visibility. For a dark-mode panel, switch the tint to a near-black and raise the alpha to 30–50%.
Text contrast on glass: the numbers
Translucent backgrounds change colour with whatever is behind them, so contrast can pass at one end of a card and fail at the other. We calculated the colour of the default glass (white at 18%) over both ends of the default gradient, then checked it against the WCAG contrast formula:
| Glass alpha | Over indigo #6366f1 | Over pink #ec4899 | White text | Dark text #111827 |
|---|---|---|---|---|
| 18% | #7f82f4 | #ef69ab | 3.28 / 2.89 | 5.41 / 6.15 |
| 40% | #a1a3f7 | #f491c2 | 2.31 / 2.17 | 7.68 / 8.17 |
| 60% | #c1c2f9 | #f7b6d6 | 1.70 / 1.66 | 10.43 / 10.66 |
WCAG AA asks for at least 4.5:1 for normal text and 3:1 for large text. So on a white-tinted glass, white text fails — and gets worse the more opaque the glass becomes — while dark text passes comfortably. If your design needs white text, use a dark tint instead. Blur averages the colours behind the card, so these blended values are a fair estimate, but a sharp bright spot (a photo's sky, say) can still push one corner lower. Check your real colours with the Color Contrast Checker.
Dark glass for white text
Switch the tint to a near-black such as #0f172a and the picture reverses. Over the same default gradient, white text then reads well:
| Dark tint alpha | Glass over indigo | Glass over pink | White text contrast |
|---|---|---|---|
| 30% | #4a4eb5 | #aa3978 | 6.89 / 5.89 |
| 40% | #4146a1 | #94346d | 8.03 / 7.07 |
| 50% | #393f8e | #7e3062 | 9.23 / 8.45 |
So the rule of thumb is simple: light glass wants dark text, dark glass wants white text, and the tint does more for legibility than the blur does.
When the blur doesn't show up
- Flat background. There's nothing to frost. Glass needs a gradient, a photo, or shapes and content scrolling behind it.
- Alpha too high. Above roughly 60%, the tint covers most of the blur and the card looks like frosted plastic.
- Stacking contexts.
backdrop-filteronly blurs what's behind the element within its backdrop root. Effects likefilter,opacitybelow 1 orwill-changeon a parent can cut it off from the page behind. If the preview here works but your page doesn't, check the element's ancestors.
A fallback for browsers and users that need one
The translucent background is already a graceful fallback where backdrop-filter isn't available. You can make it sturdier with a feature query, and respect users who ask their operating system to reduce transparency:
@supports not (backdrop-filter: blur(1px)) {
.glass { background: rgba(255, 255, 255, 0.85); }
}
@media (prefers-reduced-transparency: reduce) {
.glass { background: rgba(255, 255, 255, 0.95); backdrop-filter: none; }
}
Browser support for prefers-reduced-transparency is still incomplete, so treat it as an extra rather than your only safeguard.
Performance and restraint
Blurring is computed every time the content behind the element changes, which includes every frame while scrolling. One or two glass panels on a page are fine on most devices; a feed where every card is glass can make scrolling stutter on older phones. Keep the blur radius as low as the look allows, and use glass for focal elements — a navigation bar, a modal, a hero card — rather than everything.
For the backdrop itself, the CSS Gradient Generator builds the kind of colourful background glass needs.
Frequently asked questions
Related tools
All Color tools →- CSS Gradient GeneratorBuild linear and radial CSS gradients with two colour stops, an angle slider and a live preview — then copy the code.
- CSS Box-Shadow GeneratorDesign layered box-shadows visually and copy the CSS.
- Color ConverterConvert any color between HEX, RGB and HSL instantly — pick, preview and copy in one place.
