Why one shadow never looks right
Real shadows are not a single blur. Light falls off, surfaces bounce it back, and what your eye reads as depth is several overlapping penumbras of different softness. A CSS box-shadow with one layer at 20% opacity reads as a sticker glued to the page; the same depth expressed as two or three layers — a tight, slightly darker one near the element and a wide, very light one further out — reads as an object sitting above a surface.
This generator supports multiple layers for exactly that reason, and the preview updates as you drag each slider.
The parameters, and what each one is for
- Offset X and Y place the shadow, which implies where the light is. Keep the offset small relative to the blur; a large offset with little blur reads as a hard-edged duplicate, not a shadow.
- Blur is the softness. Higher elevation means a larger blur, as a real shadow spreads when the object rises.
- Spread grows or shrinks the shadow before blurring. A negative spread is the trick behind tasteful card shadows: it pulls the shadow in so it does not leak out around the sides.
- Opacity should be low per layer — 5% to 20%. Depth comes from stacking, not from darkness.
- Inset draws the shadow inside the box, which is how pressed buttons and inset wells are built.
Performance note
Shadows are composited on every paint. A handful on a page costs nothing; hundreds on a long scrolling list, or a very large blur radius animated on scroll, will show up as jank on low-end devices. If you animate elevation, animate opacity on a pseudo-element carrying the shadow rather than animating the box-shadow values themselves.