Skip to content
YouNeed Tools
Free VPN

Box Shadow Generator

Start from a preset, adjust each shadow layer with the sliders and copy the box-shadow CSS. The preview shows it on a card over the background you choose.

Made on your device.

Worked example

For a product card that lifts gently off the page, use one layer: 0 px across, 4 px down, 12 px blur, no spread, black at 12% opacity. The CSS is box-shadow: 0px 4px 12px 0px rgb(0 0 0 / 0.12);. On hover, swap it for the Lifted preset so the card seems to rise.

The presets

  • Soft card: 0px 4px 12px 0px rgb(0 0 0 / 0.12)
  • Layered (smooth): 0px 1px 2px 0px rgb(0 0 0 / 0.06), 0px 2px 4px 0px rgb(0 0 0 / 0.06), 0px 4px 8px 0px rgb(0 0 0 / 0.06), 0px 8px 16px 0px rgb(0 0 0 / 0.06), 0px 16px 32px 0px rgb(0 0 0 / 0.06)
  • Lifted: 0px 20px 25px -5px rgb(0 0 0 / 0.1), 0px 8px 10px -6px rgb(0 0 0 / 0.1)
  • Hard offset: 6px 6px 0px 0px #111111
  • Pressed (inset): inset 0px 2px 6px 0px rgb(0 0 0 / 0.2)

Design tips

  • Use one light direction for the whole page: shadows that fall down and slightly right look natural.
  • On dark backgrounds, black shadows barely show; use a lighter surface color or a subtle border instead.
  • Tint shadows with the background hue (a dark blue shadow on a blue page) for a softer look than pure black.
  • Bigger offset and blur suggest more height; keep a consistent scale for buttons, cards and dialogs.

The rgb(0 0 0 / 0.12) form for the color is the modern CSS syntax for transparency; older code writes the same thing as rgba(0, 0, 0, 0.12). Both work in every current browser.

Related tools

Sources

Checked on November 26, 2026:

Frequently asked questions

What do the box-shadow values mean?
In order: horizontal offset, vertical offset, blur radius, spread radius and color, with an optional inset keyword. box-shadow: 0 4px 12px 0 rgb(0 0 0 / 0.12) puts a soft shadow 4px below the element.
What is the difference between blur and spread?
Blur softens the edge: bigger values make a wider, fainter shadow. Spread grows (positive) or shrinks (negative) the shadow’s size before it is blurred; a negative spread keeps a shadow tucked under the element.
How do I make a realistic shadow?
Layer several soft shadows with increasing offset and blur and low opacity, like the Layered preset. Real shadows are darker and sharper close to the object and lighter further away.
What is an inset shadow?
A shadow drawn inside the element’s border, which makes it look pressed in, like an input field or a pushed button.
Does box-shadow slow pages down?
Static shadows are cheap. Animating large blurred shadows can be heavy; animate the opacity of a pseudo-element that holds the shadow instead.
box-shadow or drop-shadow?
box-shadow follows the element’s box (and rounded corners). filter: drop-shadow() follows the actual shape of transparent images and SVG icons, but has no spread or inset.

Last updated: 2026-11-26