Colour CSS

Box shadow generator

Layer 1

Generated in your browser · nothing is uploaded

Live preview · stack layers for a real shadow

Builds a box-shadow from offset, blur, spread and colour, with as many stacked layers as you want and an inset option. The preview is a real element with the shadow applied.

How to use the box shadow generator

1 Drag the horizontal and vertical offset, then the blur, then the spread.
2 Add a second layer. Real shadows are never a single one.
3 Tick inset for a shadow drawn inside the box instead of outside it.
4 Copy the CSS, remembering that the first layer in the list paints on top.

The one change that makes a shadow convincing is using more than a single layer. A real shadow is dense and tight where the object nearly touches its surface, and soft and wide further out, and no single shadow is both at once. Stacking two or three, a small dark one at low blur under a larger faint one at high blur, is what every design system does. It is also the reason a hand-written single shadow reads as a grey smear rather than as depth. Layers paint in order with the first on top, so the tight dark one belongs at the start of the list.

Spread is the value people skip and it does the most interesting work. It grows or shrinks the shadow before the blur is applied, which makes two useful things possible. A negative spread with a large blur pulls the shadow in tighter than the box and then softens it, giving the halo of genuine contact directly beneath a card. And a shadow with zero blur and a positive spread is not really a shadow at all: it is a ring that follows the border radius, sits outside the element, and takes up no space in the layout, which is why focus rings are so often built this way. The blur value is not a Gaussian standard deviation either; the specification asks for a blur approximating a Gaussian with a deviation of half the stated radius, so a 12px blur fades out over roughly 12px beyond the spread edge rather than 24.

Colour choice matters more than the numbers. Pure black at low alpha looks grey and lifeless, because a real shadow is the absence of a coloured light rather than a wash of neutral ink. Taking the hue of the surface underneath and darkening it, so a slightly blue-black on a cool page, reads as light instead of as dirt. None of that is a CSS feature; it is only what looks right.

What people use it for

  • Getting a card off the page without the shadow reading as a grey smudge
  • Building a focus ring from zero blur and a positive spread
  • Putting a soft contact shadow under an element with a negative spread
  • Matching an elevation step from a design system by eye
  • Adding an inner shadow to a pressed or inset control

Questions

Almost always because it is one layer. A real shadow is tight and dark close in and soft and wide further out, and that needs at least two declarations stacked.

MDN, box-shadow
Was this tool any good?
Internal signal only · I use it to find the tools worth rebuilding