Box Shadow Generator

Create CSS box-shadow effects visually with a live preview and copyable code, covering layered shadows, inset shadows and what makes a shadow look real.

Spread is applied before the blur, and it grows every side

The order is fixed: take the border box, move it by the offset, inflate it by the spread, then blur the result. Spread is not "more blur" and it is not "a stronger colour" — it grows the solid shape that the blur is then applied to.

What that decides in practice is how much room the shadow needs outside the element, which is what determines whether a parent with overflow: hidden clips it:

box-shadowLeftRightTopBottom
0px 0px 24px 0px12121212
6px 8px 24px 0px618420
6px 8px 24px 10px16281430
0px 4px 8px -4px0004

Compare rows two and three: ten pixels of spread added ten pixels on every side, including the ones the offset was pulling away from. That is the asymmetry to remember. Offset moves a shadow and leaves its total size alone; spread grows it in all four directions at once.

Negative spread can hide a shadow completely

Spread goes negative, which shrinks the shape. With an 8px downward offset and no blur, sweeping the spread down:

SpreadVisible below the boxAnything outside at all?
0px 8px yes
-4px 4px yes
-8px 0px no
-12px 0px no
-16px 0px no

It disappears exactly when the spread reaches the offset, at -8px — every edge is then at or inside the element, and the element is painted on top. That is the mechanism behind the tight shadows in a lot of interface work: a small positive offset with a negative spread produces a shadow that peeks out of one edge only. It is also why a shadow can vanish when somebody nudges a slider and nobody can work out where it went.

A blur keeps it visible past that point, because the blur reaches outward from wherever the shrunken shape ended up. So the vanishing is specifically about spread against offset, not about the numbers being small.

Two more things the sliders do not hint at

The shadow's corners follow the element's, and the radius grows with the spread — except that a zero radius stays zero:

Element radiusSpreadShadow radius
0px 10px 0px
4px 10px 14px
12px 10px 22px
12px -8px 4px
12px -20px 0px

A square element casts a square shadow however much you spread it, and a negative spread clamps at zero rather than going inside out. The rule matters under a rounded card: a large spread makes the shadow noticeably rounder than the thing casting it, and that mismatch tends to read as a blur artefact rather than as geometry.

And inset puts the offset on the opposite edge. An outer shadow offset downwards falls below the box; an inset one offset downwards appears at the top:

OffsetOuter shadow landsInset shadow lands
6px 8px right and bottom left and top
-6px 8px left and bottom right and top
0px 8px bottom top
0px -8px top bottom

Opposite in every case, and it makes physical sense: an inset shadow is the darkness of a surface pressed away from you, so if the light side moves down then the dark side is the top edge. The consequence is that ticking the inset box with the offsets unchanged moves the shadow diagonally across the element rather than simply turning it inside out.

How to use

  1. Adjust offset, blur, spread and colour.
  2. Add more layers for a realistic effect.
  3. Toggle inset for an inner shadow.
  4. Copy the generated CSS.

Frequently asked questions

What do the four numbers mean?

Horizontal offset, vertical offset, blur radius and spread. Offset moves the shadow, blur softens its edge, and spread grows or shrinks it before blurring. Only the offsets are required; blur and spread default to zero, which produces a hard-edged copy of the shape.

Why do my shadows look fake?

Usually because there is only one, and it is too dark and too sharp. Real shadows are soft, subtle and rarely pure black — they take on the colour of the surroundings. Layering two or three shadows of different blur radii and low opacity looks far more convincing than one strong shadow.

What does a negative spread do?

Shrinks the shadow before blurring it, which keeps it tucked behind the element rather than spilling out at the sides. Combined with a downward offset, it produces the impression of an object resting close to a surface rather than floating above it.

What is an inset shadow?

A shadow drawn inside the element rather than outside, which makes the element read as recessed. It is used for pressed buttons, input fields and the inner depth of a well. The same offset that moves an outer shadow one way moves an inset shadow the other.

Are box shadows bad for performance?

Large blurred shadows are relatively expensive to paint, and animating a shadow forces a repaint on every frame. If you need a shadow to change on hover, animating opacity on a pseudo-element carrying the shadow is far cheaper than animating the shadow itself.

How does box-shadow differ from drop-shadow?

Box-shadow follows the element's rectangle and border radius; the drop-shadow filter follows the actual shape, including transparency in an image or a clip-path. For a shadow around a non-rectangular shape, drop-shadow is the only one that works.

🔒 This tool runs entirely in your browser. Nothing you enter is uploaded, logged, or stored.