CSS generators

Glassmorphism CSS Generator

Design frosted glass cards and panels on vivid backgrounds, check text contrast as you go, and copy backdrop-filter CSS with every fallback.

  • Free foreverNo trial, no paywall, no usage limits.
  • No sign-upOpen the page and start. We never ask for an email to use a tool.
  • PrivateEverything runs in your browser. Your input is never uploaded or stored on our servers.
  • Works offlineOnce the page has loaded, the tool keeps working without a connection.
Classic rgba(255, 255, 255, 0.25): works in every browser that supports backdrop-filter.8-digit hex (#ffffff40), where the last two digits are the opacity.Modern hsl() with a / alpha: easy to tweak lightness by hand.Perceptual oklch(): adjust lightness without hue shifts. Modern browsers only.
Undo (Ctrl/⌘+Z)Redo (Ctrl/⌘+Shift+Z)Randomize: surprise me with a new designReset to the starting designCopy a link that reopens this exact design

Preview

Drag the card (or focus it and use the arrow keys) to test legibility over busy and calm parts of the background.
7.8:1Estimated worst-case WCAG contrast of the card text over this background. 4.5:1 passes AA for body text.Pause the drifting backgroundCenter the card

Glass card

Frosted, but readable

Drag me over busy and calm areas. This text should stay easy to read everywhere.

BackgroundColor blobs: Soft floating color blobs, the classic glassmorphism backdrop. They drift slowly so you can watch the blur work.Mesh gradient: A vivid four-corner mesh: busy, saturated color everywhere, a tough test for text contrast.Golden hour: A photo-like sunset with a bright sun and dark hills: high contrast inside one backdrop.City night: A dark skyline under a violet sky with blurred city lights, for dark-glass designs.Aurora: Green and violet light over a near-black sky: shows how glass reads on a dark, glowing scene.Ocean: Deep blue water with a bright glare at the top, for cool, tinted glass.Neon grid: Thin neon lines and glows on black: bright details right behind the text are the hardest case.Pastel: Soft, light pastels: the calm case, where light glass needs a stronger edge to stand out.Preview on your own photo or screenshot. It is rendered locally and never uploaded.

Glass settings

Every change updates the preview and the code instantly.

Frost

backdrop-filter: what happens to the scene behind the glass.
How much the backdrop is blurred. 8–20px reads as frosted glass; more blur calms busy backgrounds but costs more GPU time on large panels.
px
Boosts the colors seen through the glass. Blur washes colors out; 150–180% brings back the vivid, polished look.
%
Darkens (below 100%) or lightens (above 100%) the backdrop before the tint is painted. Lower it to help light text.
%

Fill

The semi-transparent tint painted on top of the blurred backdrop.
The glass color. White reads as frosted glass, black as smoked glass, a brand color as tinted glass.
How opaque the glass is. Lower shows more of the background; higher makes text easier to read.
%

Edge

A thin, light border sells the illusion of a glass edge catching light.
1px is the usual glass edge. 0 removes the border entirely.
px
Usually white at low opacity, so the edge reads as reflected light rather than an outline.
Border opacity. 20–40% looks like a natural glass edge; higher looks like a frame.
%
Rounded corners. 16–28px matches the soft, modern glass look; 0 gives sharp panes.
px
A 1px inner light line along the top edge, like light catching the rim of real glass. Adds depth for almost no cost.

Depth

A shadow lifts the glass off the background.
Flat: the glass sits on the background.A light, close shadow for subtle lift.The classic floating-card shadow.A deep shadow for modals and hero cards. With a colored shadow it becomes a glow.
Black for a natural shadow. A bright color (cyan, magenta) turns the shadow into a neon glow.

Text and contrast

An estimate: the tint is composited over the backdrop's lightest, darkest and average colors, and the lowest WCAG ratio is shown.
Picks dark or white text, whichever has the better worst-case contrast on this glass.Choose your own text color and check its contrast.
Worst-case contrastWCAG 2 asks for 4.5:1 for body text and 3:1 for large text (24px, or 18.66px bold). Busy photos vary a lot, so check the preview with the card over the brightest and darkest areas.7.8:1
  • Passes AA body text (4.5:1)
  • Passes AA large text (3:1)

Code

Copy the code into your stylesheet. The fallbacks are part of a good glass effect, not extras.
Plain CSS with the -webkit- prefix and fallbacks for no backdrop-filter, reduced transparency and high contrast.Tailwind CSS v4 classes: exact arbitrary values, plus the nearest built-in utilities.Sass variables and a reusable glass() mixin with every fallback built in.
Copy CSSDownload glass.css
The -webkit-backdrop-filter line covers Safari releases that only understand the prefixed property. Keep both.

Presets

One click applies a preset. Undo (Ctrl/⌘+Z) brings your previous design back.
  • The classic: white frost, vivid colors showing through, a crisp top highlight.
  • Smoky dark glass for dark interfaces and night scenes.
  • Strong blur and boosted color, like the control panels on modern phones.
  • A light, heavily frosted panel like a desktop app sidebar: calm, legible, barely tinted.
  • Glass with a brand-blue tint and a matching light edge.
  • A playful pink tint on soft pastels.
  • Dark glass with a cyan edge and a colored glow, for gaming and tech UIs.
  • Barely there: a light blur and a faint edge for overlays that should not compete.
  • Maximum frost: the backdrop dissolves into color, which keeps text easy to read.
  • Almost no blur, a bright rim and a soft shadow: glass you can see straight through.
  • Black-tinted glass that darkens the scene behind it, so white text pops.

Want a site designed with this level of care? Talk to our team

Quick answer

Glassmorphism is a UI style that makes a panel look like frosted glass: a semi-transparent fill over a backdrop blurred with the CSS backdrop-filter property, finished with a thin light border and a soft shadow. In Playxoft's free Glassmorphism CSS Generator, adjust blur, saturation, tint and edge, drag the glass card over the background to check legibility, then copy CSS, Tailwind or SCSS with the -webkit- prefix and accessible fallbacks.

  • Draggable live preview
  • Your own background image
  • Text contrast estimate
  • Prefix and fallbacks
  • Tailwind v4 classes
  • Sass mixin
  • 11 presets
  • Undo, redo and share links

How to use the Glassmorphism Generator

  1. 1Pick a Background that matches your design, or click Your image to test on your own screenshot (it never leaves your browser).
  2. 2Frost the backdrop with Blur and Saturation, then choose a Tint and its Opacity.
  3. 3Shape the edge with Border width, Border color, Corner radius and Top highlight, and choose a Shadow.
  4. 4Drag the glass card over the busiest part of the background and watch Worst-case contrast. If it fails, raise the opacity or blur.
  5. 5Open the CSS, Tailwind or SCSS tab and copy the code, or click Share to send a link that reopens this exact design.

How does backdrop-filter create the glass effect?

backdrop-filter applies filter functions such as blur(), saturate() and brightness() to everything painted behind an element, inside its border box and clipped by its border-radius. The element's own background has to be at least partly transparent, otherwise it simply covers the filtered backdrop. That is why every glass recipe pairs the filter with an rgba() fill:

.glass {
  background: rgba(255, 255, 255, 0.25);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 20px;
}

Blur alone washes colors out, so a saturate() boost of 150–180% brings back the vivid look. The light border reads as the edge of the pane catching light.

Two side effects surprise people. Any value other than none creates a stacking context and makes the element the containing block for position: fixed descendants, so a fixed dropdown inside a glass panel is positioned against the panel, not the viewport. And the filter only sees content up to the nearest ancestor that has opacity below 1, a filter, mask, clip-path, mix-blend-mode or its own backdrop-filter (the spec's Backdrop Root). Nested glass inside glass therefore blurs only what is inside the outer pane. The spec is Filter Effects Module Level 2.

Which browsers support backdrop-filter?

Chrome 76+, Edge 79+ and Firefox 103+ support backdrop-filter without a prefix. Safari needed -webkit-backdrop-filter from version 9 until Safari 18 added the unprefixed property, so ship both lines with the prefixed one first. For anything older, add an opaque-enough fallback that only applies when neither form is understood:

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass {
    background: rgba(255, 255, 255, 0.85);
  }
}

The generator also writes a prefers-reduced-transparency block. Only Chromium browsers (Chrome and Edge 118+) support that media feature today; Safari does not, and Firefox keeps it behind a flag. Treat it as progressive enhancement, and make the default glass readable on its own.

Is backdrop-filter bad for performance?

It can be, on large areas. Whenever the pixels behind a glass element change, the browser has to read them back and blur them again, and the work grows with both the blurred area and the blur radius. Small cards over a static background are cheap on modern hardware. The expensive cases are predictable:

  • Full-screen glass over video, animated gradients or a scrolling feed re-blurs a huge area every frame. Test sticky glass headers on a mid-range phone.
  • Animating the blur radius itself is costly. Animate the panel's opacity or transform instead.
  • Stacked glass layers each re-sample the backdrop. One pane usually looks better anyway.
  • `will-change: backdrop-filter` keeps a compositor layer alive and uses memory. Add it only to elements that really animate, and remove it afterwards.

The drifting blobs in the preview are there to show the blur updating live. Pause them if your device runs warm.

How do I keep glassmorphism accessible?

Glass puts text on a background you do not fully control, which makes contrast the main risk. WCAG 2 asks for 4.5:1 for body text and 3:1 for large text, and on glass that ratio changes as the card moves over light and dark areas. This tool estimates the worst case by compositing your tint over the backdrop's lightest, darkest and average colors. For exact numbers on a final pair of colors, use the color contrast checker.

  1. Raise the tint opacity first. It is the single most effective fix.
  2. Add blur. It averages out detail, so the backdrop varies less behind each letter.
  3. Lower brightness behind light text, or use a lighter tint behind dark text.
  4. Do not lean on a soft text-shadow. A faint, blurred shadow barely changes measured contrast and makes small text look fuzzy. Only a solid outline or halo strong enough to act as the text's background counts, and it rarely looks like glass.
  5. Honor user settings. prefers-reduced-transparency: reduce and prefers-contrast: more both get a near-solid panel in the generated code.

Glassmorphism vs neumorphism vs solid panels: which should I use?

StyleHow it is builtBest forWatch out for
Glassmorphismbackdrop-filter blur, translucent fill, light borderOverlays, nav bars and hero cards over rich, colorful backgroundsContrast over busy backdrops, GPU cost on big areas
NeumorphismA light and a dark box-shadow on a surface the same color as the pageSoft, tactile controls in minimal interfacesVery low contrast; element edges almost disappear
Solid panelOpaque fill and an elevation shadowLong text, forms and dense dataLess depth and drama over imagery

Many polished interfaces mix them: glass for the navigation and floating toolbars, solid panels for the content people actually read. To design the shadows for any of these, try the box shadow generator, and build the vivid backdrop itself with the CSS gradient generator.

Frequently asked questions

Give the element a semi-transparent background such as rgba(255, 255, 255, 0.25), add backdrop-filter: blur(16px) together with -webkit-backdrop-filter for Safari, then a thin light border, rounded corners and a soft box-shadow. The element must sit over something colorful, or there is nothing to blur.
The usual causes are an opaque background on the element, nothing interesting behind it, a missing -webkit- prefix for Safari, or an ancestor with opacity below 1, a filter, a mask or its own backdrop-filter. That ancestor limits what the blur can see to its own content.
Yes. Combine a translucent background like bg-white/25 with backdrop-blur-lg and backdrop-saturate-150, a light border such as border-white/30, rounded corners and a shadow. The Tailwind tab gives both exact arbitrary values and the nearest built-in utilities.
It can be, if text keeps at least 4.5:1 contrast over the lightest and darkest parts of the backdrop. Raise the tint opacity, add blur or darken the backdrop until it passes, and serve a solid fallback for people who turn on reduced transparency or high contrast.
Roughly 8 to 20 pixels reads as frosted glass in most designs. Lower values keep the backdrop recognizable, higher values turn it into soft color. Busy photos need more blur than smooth gradients.
It can on large areas. The browser re-blurs the pixels behind the element whenever they change, so full-screen glass over video or scrolling content is the expensive case. Small cards over static backgrounds are cheap on modern hardware.
No. The image is shown through a local object URL and measured on a tiny canvas in your browser. Nothing is uploaded, and the image is never included in share links.

Last updated by the Playxoft engineering team.

From the designers who built this tool

Want your site to look this polished?

Consistent color, crisp typography and fast pages are what make a site feel premium. We build accessible, high-converting websites with design systems that stay consistent everywhere. Send us your site and we will share honest recommendations, free.