ToolSphere

CSS Box Shadow Generator

More tools

Design layered CSS box shadows with live preview. Adjust horizontal and vertical offsets, blur radius, spread, opacity, and inset shadows with ready CSS.

Layer 1
CSS
box-shadow: 0px 4px 12px -2px rgba(15, 23, 42, 0.18);

Stacking two or three low-opacity layers reads as a real shadow; one heavy layer reads as a sticker. Keep the offset small relative to the blur.

On this browser only

Give feedback

Did this tool help?

Tell us what worked, what didn’t, or what you’d like next.

Opens Google Forms in a new tab with this tool’s name filled in. No sign-in or email required. Feedback is optional.

How to use CSS Box Shadow Generator

  1. 1Drag offset, blur, spread and opacity to shape the first layer.
  2. 2Add a second or third layer for realistic depth rather than one heavy shadow.
  3. 3Tick inset for pressed buttons and inset wells.
  4. 4Copy the generated box-shadow declaration.

About CSS Box Shadow Generator

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.

Frequently asked questions

Why does my shadow look fake?

Almost always one layer at too high an opacity. Real depth comes from stacking two or three layers at 5-20% — a tight darker one near the element and a wide, very light one further out.

What does a negative spread do?

It shrinks the shadow before blurring, pulling it in so it does not leak out around the sides. It is the main trick behind restrained card shadows.

When should I use inset?

For anything that should look recessed rather than raised: pressed button states, input wells and inset dividers.

Are box shadows expensive to render?

A handful cost nothing. Hundreds on a long scrolling list, or a large blur animated on scroll, can cause jank on low-end devices. Animate the opacity of a pseudo-element carrying the shadow instead of animating the shadow values.

Have a suggestion for CSS Box Shadow Generator?Share your feedback ↗