🔒 100% private — runs in your browser, nothing is uploaded

CSS Box Shadow Generator

Design box shadows visually — offsets, blur, spread, colour, opacity and inset — and copy the exact box-shadow CSS.

A box-shadow value is a small recipe read in a fixed order: offset-x, offset-y, blur radius, spread radius, then the colour, with the optional word inset in front. The offsets position the shadow relative to the box, the blur softens its edge (0 means a hard, solid edge), and the spread expands or shrinks the shadow shape before blurring — a negative spread pulls it in so it only peeks out on the offset side. The classic soft card shadow is box-shadow: 0px 8px 24px 0px rgba(0, 0, 0, 0.15): no horizontal shift, an 8px drop, a blur three times the drop, no spread, and black at just 15% opacity. The colour is written as rgba() rather than a hex value precisely so that opacity can ride along — a translucent black shadow darkens whatever sits behind the card, which is why the same declaration looks right on white, grey and photo backgrounds alike.

Preview card — the shadow under this card is the one you are building.

Everything runs in your browser; your values are never uploaded, stored or put into a link. The preview uses the exact declaration shown above, so what you see is literally what the CSS does.

Quick answers

How do I write a soft card shadow in CSS?

box-shadow: 0px 8px 24px 0px rgba(0, 0, 0, 0.15) — no horizontal offset, an 8px downward drop, blur about three times the offset, zero spread and black at 15% opacity.

Raise the opacity toward 0.25 or deepen the offset for a more lifted, floating card; drop it toward 0.08 for a nearly flat design.

What is the difference between blur and spread in box-shadow?

Spread resizes the shadow shape first (positive grows it, negative shrinks it), then blur feathers its edge. Spread changes where the shadow reaches; blur changes how hard its edge looks.

A negative spread slightly smaller than the blur hides the shadow on three sides, leaving a soft glow only where the offset points — a common trick for bottom-only shadows.

How to use

  1. Drag the offset sliders to move the shadow horizontally (X) and vertically (Y) — positive X moves it right, positive Y moves it down.
  2. Set the blur radius for softness and the spread radius to grow or shrink the shadow before the blur is applied, then pick a colour and its opacity.
  3. Tick Inset to move the shadow inside the box, which reads as a pressed or recessed surface instead of a raised one.
  4. Watch the preview card update live, then copy the generated box-shadow declaration into your stylesheet.

About this tool

Good shadows imitate one consistent light source, so keep the offset direction the same across a whole page — if cards drop their shadows down and slightly right, a button shadow falling up-left looks like a mistake. Two working rules: the blur should usually be at least the size of the vertical offset (real shadows soften as they travel), and opacity should stay low, roughly 0.08 to 0.25 for black, because a shadow is an absence of light, not a grey box. Inset shadows invert the trick: the shadow falls inside the element, which reads as a well, a groove or a pressed button — the standard treatment for active toggle states and sunken input fields. You can also stack layers by separating complete shadow values with commas, closest layer first; generate each layer here one at a time and join them.

Frequently asked questions

What do the four numbers in box-shadow mean?

In order: offset-x (horizontal shift, positive is right), offset-y (vertical shift, positive is down), blur radius (how soft the edge is — 0 is razor sharp) and spread radius (how much the shadow grows or, when negative, shrinks before blurring). Example: 2px 4px 8px 0px rgba(0, 0, 0, 0.25) is a shadow nudged right and down, softly blurred, at 25% opacity.

What does the inset keyword do?

It draws the shadow inside the box instead of outside it. Outset shadows make an element look raised off the page; inset shadows make it look pressed in or hollowed out, which suits active buttons, toggles and text inputs. The offsets work the same way, but the visible shadow appears on the opposite inner edges.

Why is the colour rgba() instead of a hex value?

Because of the fourth number: the alpha channel controls opacity. A shadow is rarely a solid colour — it is a darkening of whatever is behind the element. rgba(0, 0, 0, 0.15) darkens any background by 15%, so one declaration adapts to light and dark sections, while a solid grey hex only matches the background it was tuned on.

How do I stack two shadows on one element?

Separate two complete shadow values with a comma: box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.2), 0px 8px 24px 0px rgba(0, 0, 0, 0.12). The first value paints on top. A tight, darker contact shadow plus a wide, faint ambient shadow is the usual pairing — build each layer with this generator and join the results.

📦 Embed this tool on your site

<iframe src="https://verystep.com/embed/css-box-shadow-generator/" title="CSS Box Shadow Generator" width="100%" height="520" loading="lazy" style="border:0"></iframe>

Free to use. The embed shows a small "Powered by Verystep" link.

First time embedding? Read the step-by-step guide →

More free tools