Free ToolsGuidesCase StudiesResourcesAboutContact
Get Your Free AI Automation Audit Book a Free 30-Minute Strategy Call
Playground~/frontend Open editor

~/css/box-shadow-generator

CSS Box Shadow Generator

GeneratorRuns in your browserFree · no sign-up

Tune a CSS box-shadow with sliders and see it on a card straight away: horizontal and vertical offset, blur, spread, colour, opacity and inset. Switch the preview between a light and a dark page, then copy the rule.

Preview page
Card
CSS

Using the CSS Box Shadow Generator

What each value does

The two offsets move the shadow right and down (negative values move it left and up). Blur softens the edge; a larger blur makes the shadow look further from the surface. Spread grows or shrinks the shadow before it is blurred. Inset puts the shadow inside the element, which makes it look pressed in.

Shadows that look natural

Real shadows are soft and fall downward, because light usually comes from above. Keep the vertical offset larger than the horizontal one, use a low opacity, and add a negative spread on large blurs so the shadow does not spill out on every side. Tinting the shadow with your background colour instead of pure black looks less dirty.

Two layers beat one

The optional second layer adds a tight, faint shadow close to the element underneath the wide soft one. Together they read as an object resting on the page, which a single blurred shadow rarely achieves.

Shadows on dark backgrounds

A black shadow on a near-black page is invisible. On dark designs, show depth with a lighter surface colour or a thin light border instead, and use the shadow only to separate floating elements such as menus and dialogs.

What shadow should a card use?

Most interfaces use small offsets and generous blur in a dark, partly transparent colour, for example a vertical offset of 4 to 8 pixels, blur of 12 to 24 pixels and 10 to 20 percent opacity. Larger, softer shadows suggest an element is higher above the page, which suits dialogs and dropdowns rather than resting cards.

Worked example: a hover lift

Give a card a small shadow at rest and a larger one on hover, and add transition: box-shadow 0.2s. The card appears to lift towards the pointer. For smoother animation on long lists, put the larger shadow on a pseudo-element and fade its opacity instead of animating the shadow itself.

Frequently asked questions

Can I layer more shadows?

Yes, box-shadow accepts a comma-separated list. Generate each layer here and join them with commas.

Does box-shadow slow pages down?

A static shadow costs almost nothing. Animating a large blurred shadow can be expensive; animate the opacity of a pseudo-element that carries the shadow instead.

What is the difference from drop-shadow?

box-shadow follows the element's box. The filter: drop-shadow() function follows the visible shape, including transparent PNG and SVG edges, and is available in the CSS filter generator.

Why does my shadow look grey and dirty?

Pure black shadows at high opacity look heavy. Lower the opacity, increase the blur, or tint the shadow with a dark version of the background colour so it blends in.

Can a shadow appear on one side only?

Yes. Use an offset towards that side and a negative spread equal to roughly the blur, which pulls the shadow in from the other sides.