CSSMar 17, 2026 ยท Updated Oct 13, 2026 ยท 3 min read

How to Create CSS Glow Effects (Neon, Soft, Animated)

Neon box and text glows in CSS, and what animating them costs. In a Chromium trace, 12 buttons pulsing via box-shadow caused 2,353 paints in 3 seconds; the same glow on ::after with an opacity animation caused none.

๐Ÿ’ก
Try the CSS Glow Generator
Free, no signup
โ†’
DG
Derek Giordano
Designer & Developer
In this guide
01A Glow Is a Stack of Shadows02Glowing Text03Animating a Glow: Measured

A Glow Is a Stack of Shadows

A glow is box-shadow with no offset and a growing blur, layered so the inner ring is bright and the outer rings fade:

.neon {
  box-shadow:
    0 0 5px  rgb(0 255 209 / 0.40),
    0 0 15px rgb(0 255 209 / 0.20),
    0 0 30px rgb(0 255 209 / 0.10);
}

Shadows do not take up layout space, so a 30px glow can be clipped by a parent with overflow: hidden; leave room with padding or margin. On a light background a colored glow barely shows, which is why the effect lives on dark designs.

Glowing Text

.neon-text {
  color: #00FFD1;
  text-shadow: 0 0 7px rgb(0 255 209 / 0.8), 0 0 20px rgb(0 255 209 / 0.4);
}

Text shadows are ignored by WCAG's contrast formula, so the text color itself must reach 4.5:1 on its background (3:1 for large text); #00FFD1 on #0B0D17 is about 15:1. A wide bright glow behind thin small text lowers legibility, so keep text glows for headings.

Animating a Glow: Measured

A pulsing glow is usually written as keyframes on box-shadow. We traced 3 seconds of 12 pulsing buttons in Chromium with its timeline tracing (October 13, 2026; script in our test folder), against the same glow put on a ::after layer whose opacity is animated instead:

VersionPaint events in 3 sRaster timeStyle recalcs
Keyframes on box-shadow2,3531,618 ms181
Fixed glow on ::after, animate opacity00 ms0
Static glow (no animation)00 ms0

Animating the shadow made the browser repaint and re-rasterize the glow on every frame, half the trace's time on a software rasterizer (a GPU shortens it but does not remove it). Animating opacity is handled by the compositor, so after the first frame there was no paint at all.

.glow { position: relative; }
.glow::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 20px rgb(0 255 209 / 0.5), 0 0 50px rgb(0 255 209 / 0.25);
  opacity: 0.4; animation: glow 2s ease-in-out infinite alternate;
}
@keyframes glow { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .glow::after { animation: none; } }

Keep pointer-events: none on the layer so it cannot block clicks, and honor prefers-reduced-motion; WCAG 2.3.3 asks that motion triggered by interaction can be turned off, and a pulse that never stops is the kind of motion people switch off.

The CSS Glow Generator builds box and text glows with live preview; its pulse animates the shadow directly, which is fine for a single button. For many glowing elements, move the glow onto ::after as above.

Frequently Asked Questions

How do I create a neon glow in CSS?+
Use layered box-shadow with zero offset and increasing blur radii: box-shadow: 0 0 10px color, 0 0 30px color, 0 0 60px color. Each layer should have decreasing opacity for a natural falloff.
Can I make text glow in CSS?+
Yes. Use text-shadow with the same layered technique: text-shadow: 0 0 7px color, 0 0 20px color, 0 0 40px color. Set the text color to match the glow color for the strongest effect.
Do glow effects affect performance?+
Static glows have minimal impact. Animated glows can cause repaints โ€” use the pseudo-element opacity technique for better performance on animations.
Try it yourself

Use the CSS Glow Generator โ€” free, no signup required.

โšก Open CSS Glow Generator
DG
Derek Giordano
Written by the creator of Ultimate Design Tools. BA in Business Marketing.