Box Shadow Generator

Start from a look such as Card, Floating or Inset well, then adjust each layer. The CSS updates as you go and the preview shows it on light, dark and checked backgrounds.

How it works

A box-shadow is a copy of the element's box, moved, grown or shrunk, blurred and painted in a colour behind the element. It never changes the layout: the box takes the same space with or without it.

You can give one element several shadows, separated by commas. The first one in the list is painted on top. Real objects cast a tight, dark shadow close to them and a wide, faint one further away, so two or more layers usually look more natural than one.

An inset shadow is painted inside the box instead of outside it, so the box looks pressed into the page. Inset and outer layers can sit in the same list.

Colours are written as rgba() with the opacity you set, so the shadow takes on the tint of whatever is behind the box rather than painting a grey patch over it.

How to use it

  1. 1 Pick a starting look from the row of presets.
  2. 2 Adjust each layer: across, down, blur, spread, colour and opacity. Tick Inset to move a layer inside the box.
  3. 3 Add or remove layers, and switch the preview between light, dark and checks to see it on each.
  4. 4 Press Copy CSS and paste the rule into your stylesheet.

Good to know

  • Keep shadow colours a little tinted rather than pure black. A navy shadow at 10% opacity looks cleaner on a white page than black at 10%.
  • A negative spread pulls a shadow in under the box, so the blur shows mostly at the bottom. That is how the Card preset avoids a grey halo on the sides.
  • A shadow with no blur and no spread, offset a few pixels, gives the hard neo-brutal look. The Neo-Brutalism Generator builds a whole component around it.
  • Shadows on dark pages barely show. A light border or a slightly lighter surface often separates a card better there.

Browser support

  • Chrome 94 and later
  • Firefox 93 and later
  • Safari 16.4 and later
  • Edge 94 and later

These are the oldest versions with everything the tool uses. They are worked out from the tool itself, so they change when it does.

Version numbers checked on 2026-09-04.

Where a box shadow actually lands, worked through for one card

Take a card 200 pixels wide and 100 tall with box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), a common card shadow. The browser starts with a copy of the card's box. The spread of -1px shrinks that copy by one pixel on every side, so it is 198 by 98 pixels and sits from x = 1 to x = 199. The offset of 0 across and 4px down then moves it, so its top edge is at y = 5 and its bottom edge at y = 103.

Now the blur. The CSS specification asks for a Gaussian blur with a standard deviation of half the blur radius, which gives a visible fade about twice the blur radius long, centred on each edge. So the bottom edge, at y = 103, fades from fully dark at about y = 97 to clear at about y = 109. The card ends at y = 100, so a soft band about 9 pixels deep shows below it, already part faded where it starts. The top edge, at y = 5, fades between about y = -1 and y = 11, almost all of it behind the card.

The sides are the interesting part. The shadow's side edges are at x = 1 and x = 199, one pixel inside the card, and each fades over about 6 pixels either way. At the card's own edge the shadow is already under half strength, and at 10% opacity that is too faint to read as a grey line. This is the whole job of the negative spread: without it the sides would show a halo, and the shadow would look like a frame rather than light from above.

An inset shadow follows the same arithmetic but inside the box. box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.2) moves a shadow edge 2 pixels down from the top of the box and blurs it, so the top inner edge darkens and the bottom stays clean, as if the box were a shallow well lit from above. That is the Inset well preset.

The limits. A box-shadow follows the element's box and its border-radius, not the shape of what is inside it, so a PNG with a transparent background gets a rectangular shadow; the CSS filter drop-shadow() follows the visible pixels instead and is not what this tool writes. Many large blurred shadows on one page can make scrolling less smooth on slow phones, because the browser repaints them. And the preview is drawn by your browser, so a very old browser may draw the blur slightly differently from a current one.

Frequently asked questions

What do the four numbers in box-shadow mean?

In order: how far the shadow moves across, how far it moves down, the blur radius, and the spread. Negative offsets move it left or up. The blur cannot be negative. A negative spread shrinks the shadow.

Does box-shadow affect layout or clicks?

No. The shadow is painted only. It takes no space, does not push other elements and does not receive clicks.

Why use several layers instead of one big shadow?

A single blurred shadow looks like a smudge. Light in a room makes a sharp dark shadow near an object and a soft wide one further out. Two to five layers of increasing blur and falling opacity copy that.

Is anything uploaded?

No. The CSS is written by code running in this page, and your own browser draws the preview.

Related tools

Your files are processed on your device and are not uploaded. You can verify this in your browser’s developer tools under the Network tab.