Box Shadow Generator — multi-layer CSS shadows
Drag the sliders, pick a colour, stack layers. The CSS rule updates and previews live, ready to paste straight into your stylesheet.
Drag the sliders, pick a colour, stack layers. The CSS rule updates and previews live, ready to paste straight into your stylesheet.
box-shadow: 0px 4px 12px 0px rgba(15, 23, 42, 0.15);
box-shadow paints a shadow around (or inside) an element's box. Each shadow has an X/Y offset, a blur radius, an optional spread, a colour, and an optional inset keyword. Stack multiple comma-separated shadows for layered, depth-ful results without needing an image.
Multi-layer shadows are the trick behind every modern card UI. A close, sharp shadow gives the illusion of contact with the surface; a softer, larger shadow further out gives the impression of elevation. Combining the two reads as 'lifted' the same way real-world objects do.
CSS itself imposes no limit, but rendering cost grows with each layer. Two or three layers cover almost every realistic depth effect; this tool caps at four to keep things readable.
Spread inflates (positive) or contracts (negative) the shadow before the blur is applied. Spread of 5 makes the shadow bigger by 5 pixels in every direction; -5 shrinks it by the same amount. Useful for tight, contained shadows or for cancelling the natural fade of blur.
Inset shadows draw inside the element instead of outside. Use them to suggest a recessed or pressed state — for example, a button that depresses on click, or a 'inner card' that appears carved into the background.
Lower opacity dramatically — 0.10-0.15 instead of 0.25 — and prefer pure black with very low alpha. White or light shadows around dark content can also imply elevation but feel more neon than realistic.
A single layer with reasonable blur is essentially free. Heavy multi-layer shadows on hundreds of elements scrolling can hurt; if you hit a perf wall, switch the heavy decorative shadow to an SVG filter or a static PNG.
Where a well-tuned shadow makes the UI feel polished.
A two-layer 'lifted' shadow gives a card the appearance of floating above the page, far cheaper to render than an SVG filter and matching what users expect from native UIs.
A larger, softer shadow signals that the element sits well above the rest of the page. Increase the Y offset and blur for these to read as 'highest layer'.
Switch to inset on :active to give the button a tactile press feel. Pair with a slight downward Y translate for the most convincing effect.
A 1-2px shadow with very low alpha can replace a hairline border for grouping items, with the bonus of better visibility on complex backgrounds.
Small habits that keep shadows from looking dated.
A single big blurry shadow looks soft but flat. Pairing a small tight shadow (contact) with a larger soft one (ambient) reads as real-world depth.
Most modern designs keep shadow alpha under 0.20. Higher values look like the era of skeuomorphism. Compensate with more blur for a smoother fade if the shape feels too hard.
Pick a single light direction (usually top-down) for your whole UI. Mixing 'sunlight from the upper-left' with 'lamp from the lower-right' across components looks chaotic.
box-shadow: inset 0 0 0 1px <color> creates a perfect inner border that doesn't shift layout the way a border property does. Useful for hover/focus rings on inputs.