CSSMar 30, 2026 · Updated Oct 13, 2026 · 3 min read

How to Create CSS Text Shadows (With Examples)

CSS text-shadow adds visual depth, outlines, and effects to text. From subtle reading-enhancement shadows to dramatic neon glows and 3D letterpress effects, text-shadow is the simplest way to make typography more impactful — especially on dark backgrounds.

✨
Try the Text Shadow Generator
Free, no signup
→
DG
Derek Giordano
Designer & Developer
In this guide
01Text-Shadow Syntax02Common Text Shadow Effects03Worked Example: Outline Methods Compared04Layered Text Shadows05Text-Shadow vs Box-Shadow

Text-Shadow Syntax

text-shadow takes four values:

text-shadow: offset-x offset-y blur-radius color;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);

Offset-x moves the shadow horizontally. Offset-y moves it vertically. Blur-radius softens the edge (0 = sharp). Color should use rgba() for natural semi-transparency.

Common Text Shadow Effects

Subtle depth: text-shadow: 0 1px 2px rgba(0,0,0,0.2) — barely visible, improves readability over images.

Hard outline: text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000 — four shadows create a solid outline.

Neon glow: text-shadow: 0 0 7px #00FFD1, 0 0 20px #00FFD1, 0 0 40px #00FFD1 — layered zero-offset shadows.

Letterpress: text-shadow: 0 -1px 0 rgba(0,0,0,0.5), 0 1px 0 rgba(255,255,255,0.1) — top shadow for depth, bottom highlight for emboss.

Worked Example: Outline Methods Compared

A common claim is that the four-shadow outline leaves gaps and you need eight shadows or -webkit-text-stroke. We rendered "WAVE" in 120px Arial Black-style type in Chromium 141 with each method at three outline widths, and measured how much of an ideal outline ring (the letters grown by the outline width, minus the letters) each one actually painted dark (script and results in our test folder, October 13, 2026):

Outline width4 shadows8 shadowstext-stroke + paint-order
2 px87.4%87.7%83.8%
4 px93.2%93.8%92.1%
8 px95.4%96.7%96.1%

The differences are small — at most about four percentage points, mostly at sharp corners, and none of the methods covers a perfectly round ring. Pick by convenience: shadows work everywhere and can be blurred; -webkit-text-stroke with paint-order: stroke fill keeps the stroke behind the letters (without paint-order half of the stroke is drawn over the fill and makes letters look thinner). Remember that shadows do not change the text's own color, so check contrast against the background behind the text, not against the shadow.

Layered Text Shadows

Like box-shadow, text-shadow supports multiple comma-separated values. Each shadow renders independently. Use this for 3D text effects:

text-shadow:

1px 1px 0 #d35400,

2px 2px 0 #c0392b,

3px 3px 0 #e74c3c,

4px 4px 0 #e67e22;

This stacks four colored shadows at increasing offsets, creating a retro 3D text effect. The Text Shadow Generator lets you build and preview all these effects with sliders.

Text-Shadow vs Box-Shadow

text-shadow follows the shape of each character glyph. box-shadow follows the element's rectangular box (or border-radius). text-shadow doesn't support spread-radius or the inset keyword. Use text-shadow for typography effects; use box-shadow for container and card effects.

Frequently Asked Questions

How do I add a shadow to text in CSS?+
Use text-shadow: offset-x offset-y blur-radius color. Example: text-shadow: 2px 2px 4px rgba(0,0,0,0.3) adds a soft shadow down-right of the text.
Can I create a text outline with CSS?+
Yes. Use four text-shadows at offset combinations of -1px and 1px with zero blur: text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000.
What is the difference between text-shadow and box-shadow?+
text-shadow follows character shapes. box-shadow follows the element's rectangular box. text-shadow has no spread or inset options. Use text-shadow for text effects, box-shadow for element containers.
Try it yourself

Use the Text Shadow Generator — free, no signup required.

⚡ Open Text Shadow Generator
DG
Derek Giordano
Written by the creator of Ultimate Design Tools. BA in Business Marketing.