Guide

CSS text shadows: glow, outline and long shadows

Reviewed 23 November 2026 · 6 min read · Written and maintained by Toolnexo

The text-shadow property draws a copy of the text behind it, offset and blurred as you choose. One shadow gives depth. Several stacked shadows give glows, outlines and long shadows. This guide covers the syntax, the order in which layers are painted, and five recipes with their exact values. The values come from the CSS text shadow generator on this site, which runs in your browser, so nothing you build is uploaded.

The syntax

A shadow is written as a horizontal offset, a vertical offset, an optional blur radius and a colour: text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4). A positive horizontal offset moves the shadow right and a positive vertical offset moves it down. A blur of 0 gives a hard edge, and larger values soften it. Unlike box-shadow there is no spread value and no inset, so bigger or inner effects have to be built from several layers.

Layers and their order

Separate shadows with commas. The first shadow in the list is painted on top and every later one sits behind it. That matters when a sharp layer and a soft glow overlap: put the sharp one first so it stays in front. The generator allows up to eight layers, and it writes several layers on separate lines so the declaration is easy to read and edit.

Recipe: a soft shadow

text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.3) lifts text a little off a light background. The 2-pixel drop and the 4-pixel blur are small enough to look natural, and the 30 percent black keeps it quiet.

Recipe: a neon glow

A glow is several layers with no offset and growing blur, in a bright colour, on a dark background. The Neon glow preset uses four: 0 0 6px white, then 0 0 14px, 0 0 28px and 0 0 48px in cyan shades, the last a little deeper than the others. The small white layer makes the letters look lit, and the wider layers spread the halo. Fewer or larger values change how tight the glow looks.

Recipe: an outline

Four hard shadows with no blur, each offset by 1 pixel in a different diagonal, wrap the letters in a thin line: -1px -1px, 1px -1px, -1px 1px and 1px 1px, all in the same dark colour. It is a quick way to make light text readable over a photo. For thick outlines the corners can show small gaps, because the offsets only cover four directions, and a separate property, -webkit-text-stroke, draws a true outline instead. Check that it suits your browsers before you rely on it.

Recipe: retro 3D and long shadows

  • Retro 3D: stack hard shadows in one colour that step by 1 pixel in both directions, such as 1px 1px, 2px 2px and 3px 3px, then a darker one at 4px 4px to close the edge.
  • Long shadow: stack hard layers that step by 2 pixels and fade out, such as 2px 2px at 90 percent, 4px 4px at 70, 6px 6px at 50, 8px 8px at 30 and 10px 10px at 15 percent. The fading opacity makes the shadow trail away.

Readability and cost

A shadow is not part of the text, so it does not count when contrast is measured. Judge your text colour against the background first, with the colour contrast checker, and treat the shadow as decoration. Glows on very light backgrounds are especially easy to lose.

Many large, heavily blurred layers on big text can make repainting and animation heavier on weak devices, so keep the layer count and the blur radius as low as the look allows.

Using the generator

  • Choose a preset or start with one layer, then type your own preview text and set its size and colours.
  • Edit each layer with offset X, offset Y, blur, colour and opacity, add layers up to eight and remove the ones you do not need.
  • Copy the CSS. The colours are written as rgba() values using the opacity you set.
Tools in this guide

Put it into practice

How this guide is maintained

This page is reviewed when the related tools change. It describes what the published tools actually do: the tools run in your browser tab, so your files stay on your device. If you find something inaccurate, email [email protected] and it will be corrected.

Keep reading

Other guides

All guides →