CSS Box Shadow Generator

Design single or layered box shadows and copy the CSS.

Presets:

Soft
Material 2dp
Floating
Hard
Inset
Glow
Layers
#1

Horizontal offset

0px

Vertical offset

4px

Blur radius

12px

Spread radius

0px

Opacity

15%

Box corner radius (preview)

12px

Used in the generated code, e.g. .box, .card

CSS
.box {
  box-shadow: 0 4px 12px 0 rgba(0, 0, 0, 0.15);
}

CSS Box Shadow Generator

Build anything from a subtle card shadow to a neon glow. Adjust horizontal and vertical offset, blur, spread, color, and opacity with sliders, toggle inset for inner shadows, and add more layers with the + button. The preview box and its background color are adjustable, so you can test the shadow on the same colors as your design.

Anatomy of a shadow

box-shadow: 0 4px 12px 0 rgba(0, 0, 0, 0.15);
/* x y blur spread color */
  • Offset X / Y – moves the shadow. Positive Y means light from above, which looks most natural.
  • Blur – softens the edge. Larger values make the element look higher above the page.
  • Spread – grows or shrinks the shadow before blurring. Negative spread with a large blur gives the soft "floating" look used in modern UIs.
  • Inset – draws the shadow inside the box, useful for pressed buttons and input fields.

Why layer shadows?

Real shadows have a sharp, dark core and a wide, faint outer area. Material Design and most design systems therefore combine two or three shadows in one box-shadow declaration, separated by commas. The Material 2dp and Floating presets show the technique; the first layer in the list is drawn on top.

Performance and accessibility

Shadows are cheap to draw, but animating a large blur on many elements can cost frames. Animate opacity of a pseudo-element that carries the shadow instead of the box-shadow itself. Do not rely on shadows alone to separate content: a subtle border helps users in high-contrast mode, where shadows are removed.

For translucent cards with blurred backgrounds, try the Glassmorphism Generator.

Frequently Asked Questions

Click the + button to add a layer. All layers are written into a single box-shadow declaration separated by commas; the first one is drawn on top.

Spread grows or shrinks the shadow shape before blurring, while blur softens its edge. A negative spread with a large blur creates a soft shadow that stays under the element.

Turn on Inset for the layer. The shadow is then drawn inside the element, which is useful for pressed states and input fields.

No, all current browsers support the unprefixed property. The prefix option exists only for very old Android browsers.