⚡ BreezyTools Pro — Ad-free experience across all 200+ tools. Less than a coffee a month → Learn More

CSS Box Shadow Generator

Build a CSS box-shadow visually with live preview.

box-shadow: 4px 8px 16px 0 rgba(0,0,0,0.25);

How to use the box shadow generator

Drag the sliders to set the horizontal and vertical offset (−50 to 50 px), blur (0 to 100 px), and spread (−50 to 50 px). Then pick a color and an opacity, which are combined into an rgba() value. Tick Inset to draw the shadow inside the box. The preview and the CSS line update as you move each control, and Copy CSS copies the full box-shadow declaration.

box-shadow syntax

box-shadow: [inset] <offset-x> <offset-y> [blur] [spread] [color];
  • offset-x / offset-y: positive values move the shadow right and down, and negative values move it left and up.
  • blur: zero or more, never negative. Zero gives a hard edge. Browsers approximate a Gaussian blur whose standard deviation is half the blur value, so larger numbers spread the fade over a wider area.
  • spread: grows the shadow in every direction before blurring, or shrinks it if negative. A negative spread with a vertical offset gives a shadow that shows only below the element.
  • color: if you leave it out, the shadow uses the element's text color (currentColor).
  • inset: draws the shadow inside the border, above the background and below the content.

Shadows follow border-radius, so a rounded card gets a rounded shadow. They also take up no space in the layout and don't create scrollbars.

Layered shadows look more natural

Real objects cast a tight, darker shadow close to their edge and a broad, faint one farther away. You can imitate that by listing several shadows separated by commas. The first one in the list is painted on top.

.card {
  border-radius: 12px;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.06),
    0 4px 8px rgba(0, 0, 0, 0.08),
    0 16px 32px rgba(0, 0, 0, 0.10);
}

Build each layer here, copy the value after box-shadow:, and join the layers with commas.

Shadow recipes

  • Subtle card: 0 1px 3px rgba(0,0,0,0.12)
  • Raised on hover: 0 12px 24px -6px rgba(0,0,0,0.25). The negative spread keeps it from bleeding past the sides.
  • Bottom edge only: 0 8px 6px -6px rgba(0,0,0,0.4)
  • Pressed or inner: inset 0 2px 4px rgba(0,0,0,0.2)
  • Hard offset: 6px 6px 0 0 #000, for a flat, graphic look
  • Ring: 0 0 0 3px rgba(108,60,225,0.5). Zero offset and blur with a positive spread draws an outline that follows rounded corners.

Performance and accessibility

Changing box-shadow during an animation forces the browser to repaint every frame. For hover effects, put the larger shadow on a pseudo-element and animate its opacity instead. Large blurs on many elements can also slow scrolling on low-end phones. In forced-colors mode, such as Windows High Contrast, browsers remove box shadows. A focus indicator made only from a shadow disappears there, so pair it with an outline. On dark themes, black shadows barely show, so use lighter surfaces or a subtle border to show elevation.

Frequently Asked Questions

What is the difference between blur and spread?

Spread changes the size of the shadow shape: positive values grow it and negative values shrink it. Blur softens its edges. Spread is applied first, so 0 0 0 4px is a crisp 4 px ring, while 0 0 4px 0 is a soft glow that fades out.

What does inset do in box-shadow?

It draws the shadow inside the element's border instead of outside, so the element looks pressed in or recessed. It's often used for input fields and pressed button states. You can combine inset and outer shadows in the same declaration.

How do I add multiple shadows to one element?

List them in one box-shadow declaration, separated by commas. The first shadow is drawn on top. This generator builds one shadow at a time, so create each layer, copy its value, and combine them.

Why is my box-shadow not showing?

Common causes are a parent with overflow: hidden clipping the shadow, an opacity of 0, a shadow color too close to the background, or a neighboring element painted on top of it. Also check that a later CSS rule isn't overriding the declaration.

Should I use box-shadow or filter: drop-shadow()?

Use box-shadow for rectangular or rounded boxes. Use filter: drop-shadow() when the shadow should follow the visible shape of transparent content, such as a PNG or SVG icon. drop-shadow() doesn't support spread or inset.

Is box-shadow supported in all browsers?

Yes. Unprefixed box-shadow, including inset and multiple shadows, has worked in every major browser for more than a decade, so you don't need vendor prefixes.

Love using BreezyTools?

Go Pro for an ad-free experience, priority features, and support independent development — for less than a coffee a month.

Upgrade to Pro →