Shadows that don't look pasted on
A single heavy shadow looks fake. Real shadows are soft near the object and fade out far away. Stack a tight small one with a large faint one and it feels natural. This generator lets you layer up to five shadows, each with its own offset, blur, spread and color.
Sliders update a live preview. When it looks right, copy the CSS.
Blur and spread
Blur softens the edge. Spread grows or shrinks the shadow before blurring. A positive spread makes the shadow bigger than the box. A negative spread makes it smaller, which is how you get a shadow that shows only on one side.
That trick is common in cards: a large blur, a negative spread and a vertical offset gives a lifted look with no shadow at the sides.
Inset shadows
Add the inset keyword and the shadow draws inside the box. Use it for pressed buttons, input fields and wells. Combine an inset with a regular shadow for depth.
A starter recipe
Keep opacity low. Three faint layers beat one dark one. Tint the shadow with your background hue rather than pure black, and it'll sit better on colored pages.
- Layer 1: 0 1px 2px, 10% black
- Layer 2: 0 4px 8px, 8% black
- Layer 3: 0 16px 32px, 6% black
Performance
Box-shadow doesn't change layout or spacing, since it's drawn outside the box model. But big blurs and many layers cost paint time, especially on animated or scrolling elements. On low-end phones this adds up. Use fewer layers where it counts.
Nothing you set is sent to a server.
Layered shadows look real
Real shadows aren't one blob. They have a tight, dark edge near the object and a soft, faint spread further out. Stack two or three layers to mimic that: for example 0 1px 2px at low opacity, 0 4px 8px at a bit more and 0 16px 32px faint.
Keep the color tied to your background. A pure black shadow on a colored surface can look dirty. Use a darker, slightly transparent version of the surface hue.
Performance and restraint
Large blurs on many elements cost rendering time, especially on scroll. Use them sparingly on cards that move or animate. For dark mode, shadows matter less; borders or lighter surfaces often show elevation better.
Inset shadows can make inputs look pressed. Use one subtle layer and no more.
Shadow recipes
A soft card: 0 1px 2px rgba(0,0,0,.08), 0 8px 24px rgba(0,0,0,.12). A button press: drop the blur and shrink the offset on :active. A glow: set offset to zero and use a colored, wide blur. Test dark mode, where black shadows nearly vanish and need a lighter tone.