DevTools Pro · All tools · About

Box Shadow Generator

About the Box Shadow Generator

This box shadow generator builds the CSS box-shadow property with sliders for offset, blur, spread, color, opacity and inset, and lets you stack several shadow layers in one rule. A white card on a light gray background updates as you drag, so you can judge depth before copying the code.

CSS box-shadow syntax explained

Each shadow follows the pattern [inset] offset-x offset-y blur-radius spread-radius color. The default shadow here is 0px 4px 8px 0px rgba(0, 0, 0, 0.25): no horizontal shift, 4px down, 8px of blur and a 25% black.

Positive X moves the shadow right and positive Y moves it down. Blur cannot be negative; 0 gives a hard edge. Spread grows the shadow before blurring, and a negative spread shrinks it, which is handy for shadows that only peek out at the bottom.

Layering multiple shadows

Separate shadows with commas to combine them, for example 0px 4px 8px 0px rgba(0, 0, 0, 0.25), 0px 12px 24px 0px rgba(0, 0, 0, 0.15). A tight dark shadow plus a wide soft one looks closer to real light than any single shadow.

The first shadow in the list is painted on top. That is why the tool keeps layers in order as Shadow 1, Shadow 2 and so on.

Inset vs outer shadows

Adding inset draws the shadow inside the element's border instead of outside it. Inset shadows suit pressed buttons, input fields and wells.

You can mix inset and outer layers in one box-shadow value. The layer buttons label inset layers so you can tell them apart.

box-shadow vs filter: drop-shadow()

box-shadow always follows the element's box, including its border-radius. It ignores transparent pixels inside images and the shapes of SVG icons.

For a shadow that follows the actual shape of a transparent PNG or icon, use filter: drop-shadow(0 4px 8px rgba(0,0,0,.25)) instead. Drop-shadow has no spread value and no inset option.

How to Use the Box Shadow Generator

  1. Drag Horizontal Offset and Vertical Offset (-50 to 50px) to position the shadow.
  2. Set Blur Radius (0 to 50px) for softness and Spread Radius (-25 to 25px) for size.
  3. Pick a Shadow Color and set its Opacity. Tick Inset Shadow for an inner shadow.
  4. Click Add shadow to stack another layer, switch between layers with the Shadow 1, Shadow 2 buttons, and remove one with its X.
  5. Check the preview card, then press the copy button in CSS Output.

Frequently Asked Questions

What is the difference between blur and spread?
Blur softens the shadow edge, while spread changes the shadow size before blurring. A positive spread makes the shadow bigger than the element; a negative spread makes it smaller.
Does box-shadow affect layout?
No. Shadows do not take up space or move other elements, and they do not change the element's size. They can be clipped by a parent with overflow: hidden, though.
How do I add a shadow on only one side?
Offset the shadow toward that side and use a negative spread to hide it on the others, for example 0px 8px 6px -6px rgba(0, 0, 0, 0.4) for a bottom-only shadow.
Why does my color reset to black?
The opacity is applied by converting the color to rgba(), which needs a 6-digit HEX value such as #1e293b. Other formats typed into the color field fall back to black.
Are many shadow layers bad for performance?
Large blur values on many elements, or animating box-shadow, can slow down painting. For hover effects, animate opacity or transform of a pseudo-element that holds the shadow instead.
Is my shadow sent to a server?
No. The CSS is generated in your browser and nothing is uploaded or stored.

Related tools