Skip to content
gohacks.dev
Web

CSS Box Shadow Generator

Design a CSS box-shadow with several layers, each with offset, blur, spread, colour, opacity and inset, with a live preview and copyable CSS.

Free · No sign-up · Your inputs stay in your browser

Input

Generate a CSS box-shadow

Output

CSS

97 characters

Layered shadows read as more natural than one heavy one: a tight, faint shadow for the contact edge and a wide, soft one for elevation. Shadows are painted, not laid out, so they never move other elements; animate opacity of a pseudo-element carrying the shadow rather than the box-shadow itself, which repaints every frame.

Runs in this browser. Nothing you paste is sent to a server.

Layers look natural

A single dark shadow looks pasted on. Real objects cast a sharp, faint shadow where they meet the surface and a wide, soft one further out. Two or three layers with low opacity, one tight and one large with negative spread, give depth without a heavy outline. The syntax is in MDN's box-shadow reference.

Performance

Large blurs are painted, not laid out, so they never move other elements, but animating box-shadow repaints every frame. To animate elevation, put the shadow on a pseudo-element and animate its opacity, which the compositor handles.

Share

Frequently asked questions

What does spread do in box-shadow?
It grows or shrinks the shadow before blurring. A negative spread with a large blur keeps a soft shadow underneath an element without it showing past the sides.
How do I add a shadow to only one side?
Use an offset on that side, a blur, and a negative spread about equal to the blur, so the shadow does not show on the other sides.
Is what I paste sent anywhere?
No. The tool runs entirely in your browser with JavaScript. Nothing you type or paste is sent to our server or stored.

Keep planning

Similar tools