toolqik

189 · CSS

Box Shadow Generator

Design soft, layered and inset box shadows with live preview and presets.

Runs in your browser
Several soft layers look more natural than one hard shadow.
CSS

  

About this tool

Adjust the offset, blur, spread, colour and opacity of a shadow and watch the preview update. Add layers to build realistic depth, switch a layer to inset for pressed or engraved effects, or start from a preset.

How box-shadow works

box-shadow: 0 4px 12px -2px rgb(0 0 0 / 0.15) reads as: horizontal offset, vertical offset, blur radius, spread (negative shrinks the shadow), then colour. Add inset to draw the shadow inside the box. Separate several shadows with commas; the first is drawn on top.

Shadows that look real

  • Layer them. Real objects cast a tight dark shadow close to them and a wide soft one further away. Two or three layers with increasing offset and blur and decreasing opacity look much better than one.
  • Keep opacity low. 5–20% black is plenty on light backgrounds. Pure black at full strength looks fake.
  • Tint the colour. A shadow in a darker shade of the background colour looks more natural than grey on coloured backgrounds.
  • Be consistent. Use the same light direction for every shadow on a page, usually from above.

Shadows follow border-radius. For shapes with transparency, such as PNG icons, use filter: drop-shadow() instead, which follows the visible pixels.

FAQ

How do I add a shadow in CSS?

Use box-shadow, for example box-shadow: 0 4px 12px rgb(0 0 0 / 0.15). The values are x offset, y offset, blur, optional spread and colour.

Can I use more than one shadow?

Yes. Separate shadows with commas. Layering a small sharp shadow with a large soft one gives realistic depth.

What is an inset shadow?

With the inset keyword the shadow is drawn inside the element, making it look pressed in.

What does spread do?

Spread grows (positive) or shrinks (negative) the shadow before it is blurred. Negative spread with a y offset gives a shadow only under the element.

Do shadows slow down a page?

Static shadows are cheap. Animating large blurred shadows can be expensive; animate the opacity of a pseudo-element that has the shadow instead.

esc
↑↓ navigate↵ open