Box Shadow Generator
Box Shadow Generator — drag X, Y, blur, spread, colour, alpha. Stack up to 4 layers for Material-style depth, toggle inset, copy the CSS. Free.
Tailwind:
About Box Shadow Generator
The Box Shadow Generator gives you a CSS shadow in seconds — and a fast way to refine it. Drag sliders for X and Y offset, blur, spread, colour, and alpha, watch the preview update live, stack layers for Material-style depth, toggle inset when you need a recessed look, and copy the CSS or Tailwind class when you’re done. Same workflow professional designers use, free and with no signup.
What box-shadow actually does
box-shadow paints a soft (or hard) shape behind an element to suggest depth. It takes four numeric values plus a colour: x-offset, y-offset, blur, and spread. The shadow renders outside the element by default, or inside if you prefix the value with the inset keyword. You can stack multiple shadows by comma-separating them — every serious design system, from Material Design to Vercel’s Geist to Apple HIG, does exactly this. The shadow is a paint operation, not a layout one, so it never shifts surrounding elements.
The four values, explained with examples
X offset is horizontal — 0 keeps the shadow directly behind the element, positive numbers push it right, negative push it left. Most UI shadows leave X at zero because real light comes from above, not the side. Y offset is vertical — positive pushes the shadow down (the natural direction for a top-down light), negative pushes it up. Blur is the softness of the edge — 0 is a hard outline, 24px is a soft drop shadow, 60px+ is a diffuse glow. Spread is the trick most people miss: it grows the shadow before the blur kicks in. Positive spread makes shadows feel chunky and 3D; negative spread is what designers use to keep a soft shadow tucked under the element instead of leaking out the sides. The default in this tool — 0 12px 24px 0 rgba(0, 0, 0, 0.15) — is exactly the soft drop shadow you see on resting cards in every modern app.
Soft elevation vs hard outline shadows
There are two kinds of shadow worth understanding. Soft elevation shadows have low alpha (0.06–0.20), large blur (16–48px), and zero or small offsets — they suggest the element is slightly above the surface, which is what cards, modals, and dropdowns need. Hard outline shadows have zero blur, zero or small spread, and full alpha — they act as borders without using the border property. A box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1) is the hairline ring you see on inputs in Geist and Apple’s design system. Both are useful; the mistake is using elevation shadows where outlines belong, which makes every element look like it is floating.
Multi-layer stacked shadows — Material’s ambient + direct
A single shadow always looks flat because real light has two components: ambient light (everywhere, soft, low contrast) and direct light (from one source, sharper, higher contrast). Designers fake that on screen by stacking two shadows: a small tight one for the direct contact below the element, and a larger softer one for the ambient glow further out. Together they look like the element is actually sitting on a surface, not pasted onto it. Material Design’s whole elevation system is built on this pattern, which is why Tailwind’s shadow-md, shadow-lg, and shadow-xl are all two-layer values. Click Add in the generator to stack a second layer — the new layer defaults to a tight 0 1px 2px rgba(0, 0, 0, 0.06) ambient shadow that pairs cleanly with the first. Up to four layers supported.
A note on dark mode
Shadow is darkness, and on a dark surface there’s less light to take away — so a rgba(0, 0, 0, 0.15) shadow that reads perfectly on white is nearly invisible on #0f0f0f. When designing for dark mode, bump the alpha higher (0.3–0.5 is typical) or switch the shadow colour to something lighter than the background, like rgba(255, 255, 255, 0.04). Some designers skip shadows entirely on dark surfaces and use a 1px lighter-than-background outline instead — same elevation cue, much more reliable contrast. Always preview your shadow on the actual background it will live on, in both themes, before shipping.
Free, no signup, works on any device.
Frequently asked questions
`box-shadow` is the CSS property that paints a shadow around (or inside) an element. The syntax is `box-shadow: <x-offset> <y-offset> <blur> <spread> <colour>` — for example `box-shadow: 0 12px 24px 0 rgba(0, 0, 0, 0.15)` is a clean drop shadow that sits 12px below the element. Add the `inset` keyword before the values to draw the shadow inside instead of outside. You can stack multiple shadows by separating them with commas, which is how designers build realistic layered depth.
**X offset** moves the shadow horizontally — positive pushes it right, negative pushes it left. **Y offset** moves the shadow vertically — positive pushes it down (the most common direction, since light comes from above), negative pushes it up. **Blur radius** controls how soft the edge of the shadow is — zero is a hard outline, larger values fade the shadow out gradually. **Spread radius** grows or shrinks the shadow before the blur is applied — positive makes the whole shadow larger, negative shrinks it so the shadow only shows under the element instead of leaking out the sides.
An **inset** shadow is drawn inside the element instead of outside, making the box look pressed-in or recessed. The CSS is the same four values but with the `inset` keyword in front: `box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1)`. Use inset for input fields (a tiny inset shadow at the top makes the control feel recessed), pressed button states, and skeuomorphic interfaces. Toggle the **Inset** switch in the generator and the preview will flip from outside the box to inside immediately.
**Blur** softens the edge — think of it as how far the shadow fades from solid to transparent. **Spread** grows or shrinks the entire shadow shape before blur is applied. A `0 4px 0 4px black` shadow is a hard 4px-wide ring around the element (no blur, +4 spread). A `0 4px 8px 0 black` shadow is a soft halo (8px blur, no spread). Negative spread is the secret trick designers use to make shadows feel tighter — it shrinks the shadow inward so it only shows below the element rather than leaking out the sides.