What the Box Shadow Generator does
The Box Shadow Generator builds CSS box-shadow values with a live preview. Each shadow layer has its own horizontal and vertical offset, blur, spread, colour and opacity, and can sit inside the box with Inset. Stack up to six layers for natural depth, change the box and page colours and the corner radius, and copy the CSS.
How to use it
- Start from a preset such as Soft, Layered or Glow.
- Adjust the offsets, blur, spread, colour and opacity of the selected layer.
- Use Add layer for more depth, or Inset for a pressed-in look.
- Copy the CSS.
Example
The Layered preset writes three shadows: 0 1px 2px 0 rgba(15, 23, 42, 0.08), 0 4px 8px 0 rgba(15, 23, 42, 0.08), 0 16px 32px -4px rgba(15, 23, 42, 0.12). Together they look like a card lifted gently off the page, softer and more realistic than one dark shadow.
Making shadows look real
Real shadows are soft and faint. Use a dark blue-grey rather than pure black, keep the opacity low, and offset shadows downwards as if light comes from above. Stacking a tight shadow with a wide, faint one gives the most natural result.
Glow uses no offset, a large blur and a bright colour. The Soft UI preset pairs a dark shadow at the bottom right with a white one at the top left, on a box the same colour as the page. Keep text and controls on soft UI clearly outlined, as its low contrast can be hard to see.
Questions people ask
Is anything uploaded?
No. Everything is worked out in your browser, so your colours, designs and images stay on your device.
What does spread do?
A positive spread makes the shadow bigger than the box; a negative one makes it smaller, which keeps a large blur from spreading sideways.
Do many shadow layers slow a page?
A few layers on a handful of cards are fine. Avoid animating large shadows; animate opacity or transform instead.
Is box-shadow the same as drop-shadow?
No. box-shadow follows the box; the drop-shadow() filter follows the shape of transparent images.