CSS Box Shadow Builder

How to use 3 steps
  1. Set the Horizontal offset X, Vertical offset Y, Blur radius and Spread.
  2. Pick the Shadow colour and Opacity; tick Inset for an inner shadow.
  3. Press Copy Shadow CSS and paste it into your stylesheet.

Read the full guide

Box Shadow Preview Box
Generated CSS Code

Loading the tool… 0 of 3 parts

Getting the tool ready. On a slow connection this can take a few seconds.

How this tool works

A box-shadow takes four lengths and a colour: how far right, how far down, how far the edge is softened, and how much the shadow grows or shrinks before any of that is applied. The first two place it, the blur decides whether it reads as a crisp edge or a diffuse glow, and the spread is the one most people never touch even though it is what separates a tight modern shadow from a puffy one.

Colour and opacity are combined into an rgba value here rather than being set separately, because a shadow at full strength almost never looks like a shadow. Real shadows are the absence of light rather than a layer of black paint, so the usual mistake is too much opacity rather than too little. Turning on inset moves the whole thing inside the element, which is how a pressed or recessed control is drawn.

Making a shadow that looks like light

  • Match the offset to a single light source: if one element casts its shadow down and to the right, every other element on the page should too. Mixed directions are the fastest way to make an interface look assembled from parts.
  • Larger elements need larger, softer shadows: a card lifted off the page carries a bigger blur than a button. Scaling blur and offset together with the size of the thing is what makes elevation read as consistent.
  • A single shadow is rarely the best one: the property takes a comma-separated list, and two shadows — one tight and dark for contact, one wide and faint for ambience — look considerably more convincing than either alone.
  • Spread can be negative: a negative spread pulls the shadow in tighter than the element, which is useful for a subtle lift that does not bleed out around the edges.

Full guide

5 min read

Box shadows that look like light rather than paint

Why most shadows are too opaque and not blurred enough, how to build an elevation scale, why two stacked shadows beat one, and the animation technique that avoids a repaint.

Read the guide

Frequently Asked Questions

Specific to the CSS Box Shadow Builder. Broader questions about this category are answered on the category page.

Blur softens the edge without changing the shadow's size. Spread changes the size before any blurring, so a positive value makes the shadow larger than the element.
Almost always too much opacity, too little blur, or both. A shadow is absent light, not a painted layer — start low and increase until it is only just visible.
It draws the shadow inside the element instead of behind it, which is how pressed buttons, recessed panels and inner glows are made.
Yes. The property takes a comma-separated list painted back to front. Two — one tight, one wide and faint — reads far better than one.
Large blurred ones are, especially animated or on many elements at once. A small shadow on a handful of elements costs nothing worth measuring.

Subscribe to receive notifications about new tools, features, and productivity tips.