Glassmorphism CSS Generator
Build frosted-glass CSS or a Tailwind v4 utility. Preview local images, estimate text contrast, and export opaque fallbacks and reduced-transparency rules.
- Runs in your browser
- Tool input is not uploaded to ZeroTool servers
- Free · No Sign-Up
Scan with WeChat to share this tool
Examples, details and FAQ Worked examples, how it compares with other tools, and answers to common questions.
Two outputs you can reproduce
The default glass color is white at 15% opacity, with 12px blur and 180% saturation. The generated enhancement contains:
background: rgba(255, 255, 255, 0.15);
-webkit-backdrop-filter: blur(12px) saturate(180%);
backdrop-filter: blur(12px) saturate(180%);
This is only the enhancement excerpt. Copying from the tool includes the opaque baseline and state rules. Default text #111111 on the solid white fallback has 18.88:1 contrast, displayed by truncating to two decimal places.
For a dark photo caption, enter #123 as the glass color, set opacity to 60%, blur to 8px, and saturation to 100%. Choose white text and #112233 as the fallback. The generated fill is:
background: rgba(17, 34, 51, 0.60);
backdrop-filter: blur(8px) saturate(100%);
White text on the opaque #112233 fallback is 16.14:1. That number describes the fallback only. A bright patch in a photo can lower contrast through the transparent version; use your actual image rather than treating the fallback result as a glass result.
An opaque baseline with progressive enhancement
The output begins with the fallback color. An @supports block applies transparency and filtering when either property spelling is supported. A vendor prefix supplies another spelling of the same feature; it does not supply a readable fallback by itself.
Both CSS and Tailwind output restore the solid color for prefers-reduced-transparency: reduce. A page control can add glass-opaque to an element already using glass. In forced-colors mode, the code uses Canvas and CanvasText, removes the shadow and disables filtering. These system colors leave color selection to the user's environment.
For Tailwind v4, paste the @utility glass block into the stylesheet that imports Tailwind, then use class="glass". Tailwind's custom utility documentation explains how these utilities participate in compilation. This output was compiled with Tailwind 4.3.3; it is not a Tailwind v3 configuration. Card markup and an application toggle are your responsibility.
Why the background can stop blurring
Filter Effects Level 2 describes backdrop roots. In a Chromium test on October 2, 2026, an ancestor with filter: brightness(1), opacity: .99, or will-change: opacity stopped the card from blurring stripes outside that ancestor. A transform: translateZ(0) control retained the blur. Even a visually neutral filter can therefore change what the card samples.
The draft notes that the backdrop-root definition has not reached working-group consensus. Inspect your real ancestor chain when the effect differs from this isolated preview. To blur an image element itself, use the CSS Filter Generator; it operates on a different target.
Contrast and browser boundaries
The tool estimates filtering with Canvas, composites the chosen glass fill over those pixels, and reports the minimum contrast in the padded inner rectangle. It uses the specified text color rather than antialiased glyph pixels. It does not check focus indicators, links, borders, or the complete WCAG checklist. WCAG 2.2 contrast guidance requires 4.5:1 for normal text and 3:1 for large text; 4.499:1 fails the first threshold. Use the Color Contrast Checker for individual solid color pairs.
MDN compatibility data lists unprefixed support from Chrome 76, Edge 79, Firefox 103 and Safari 18. Safari 9–17 uses the prefix. The reduced-transparency query has narrower support: Chromium supports it from 118, Firefox support is preference-gated, and Safari is not listed as supporting it. Keep the manual override; a media query alone cannot serve every browser.
Differences and limits
On October 2, 2026, changing opacity in css.glass and blur in Hype4's generator updated their CSS immediately. No fetch/XHR upload was observed during those edits. Their inspected output focused on the translucent declarations. This tool additionally exports state handling and checks a local preview background.
Images are limited to 20 MB and 50 million pixels. The preview is static and cropped; it does not model moving video, multiple glass layers or ancestors on your site. Canvas estimates can differ from CSS rendering, especially near blur edges. Unsupported Canvas filtering produces a notice instead of a fabricated score. HEX is the only color-input format. Shadow offset and blur remain fixed at 0 4px 24px; use the Box Shadow Generator for a separate shadow design.
FAQ
Does this generate CSS or an image?
It generates CSS or a Tailwind v4 @utility block. A selected image is only a local preview background; the output does not include that image, card dimensions, or layout.
What does the Opacity slider change?
How much of the glass color covers the background, from 0 to 100%; at 100% the card is a solid color. It sets the alpha of the card's background color (rgba), not the CSS opacity property, so the text stays fully opaque and the border follows its own Border opacity setting. Blur is a separate control: it softens the background behind the card.
Does Safari still need the prefix?
Safari 18 supports unprefixed backdrop-filter. Safari 9–17 requires -webkit-backdrop-filter. Both declarations are included, with an opaque baseline for browsers that support neither.
Does a passing preview certify accessibility?
No. The estimate checks the lowest pixel contrast in the inner card area against your chosen text color. Real backgrounds, ancestor effects, browser rendering, typography and system colors still need checking on the deployed page.
Can users turn off the glass effect?
Yes. Turn off transparency exports an opaque surface. The glass-opaque class also disables the effect on an exported card. Output additionally handles prefers-reduced-transparency and forced-colors.
Is my image uploaded or saved?
No. A chosen image is decoded in this tab and used only as the preview background; it is not uploaded, not written into the output and not saved in browser storage. Settings are not written to storage either. Analytics records the tool name and action generate only after a committed change that regenerates the preview or code succeeds: releasing a slider, leaving an edited color field, or switching the output format, preview background or preview state. Opening the page, typing alone, invalid settings, opening an image, Reset and system preference changes send nothing. Colors and images are not sent.