My Tool Studio
CSS

CSS Box Shadow Generator

The default box-shadow most people write, a single dark blur, looks nothing like how light behaves. This box shadow generator lets you stack up to five layers, each with its own X and Y offset, blur, spread, and color, so you can build the soft, realistic depth you see in mature design systems. Toggle any layer to inset for pressed or recessed looks. Front-end developers reach for a css box shadow generator when a card, dropdown, or modal needs believable depth, and the preview here shows every slider change on a sample card instantly. When it looks right, one click copies the finished box shadow css code.

Always freeNo sign upRuns in your browser
box-shadow: 0px 4px 12px 0px #00000033;
Layer 1
X offset0px
Y offset4px
Blur12px
Spread0px
Inset

How to use

01

Shape the first shadow layer

Drag the X offset, Y offset, Blur, and Spread sliders. Offsets run from -50 to 50 pixels, blur goes up to 100, and the color field takes any hex value including alpha.

02

Stack more layers

Click + Add layer to stack up to five shadows. Each layer gets its own controls plus an Inset switch, so you can mix outer depth with inner highlights in one rule.

03

Copy the result

The combined box-shadow declaration updates under the preview as you drag. Use the copy button to grab the full comma-separated value in one click.

Why CSS Box Shadow Generator

Common questions

Why do layered box shadows look better than one shadow?
Real objects cast a tight, dark contact shadow plus a wide, faint ambient one, and a single blur can't fake both. Stacking two or three layers with increasing blur and decreasing opacity reproduces that falloff. That's the whole reason to use a layered box shadow generator instead of hand-writing one value.
How many shadow layers can I stack here?
Up to five. Each layer keeps independent offsets, blur, spread, color, and inset state, and the output joins them with commas. The first layer in the list paints on top, so put your tightest shadow first.
What does the Spread slider do to a box shadow?
Spread grows or shrinks the shadow shape before the blur applies. A negative spread like -4px pulls a big soft shadow back underneath the element, which stops cards from looking like they're glowing. It's the least understood value and the one that most improves realism.
How do I make an inset shadow with this generator?
Yes, flip the Inset switch on any layer and it draws inside the border box instead of outside. Inset shadows suit pressed button states, text input wells, and subtle top highlights. You can mix inset and outer layers in the same rule.
What color should a box shadow be?
Almost never pure opaque black. The default here is #00000033, which is black at 20 percent alpha, and that's a sensible ceiling for most UI. On colored backgrounds, a darker shade of the background hue looks more natural than neutral gray.
Does box-shadow affect layout or performance?
It never shifts layout, since the shadow paints outside the element's box without taking space. Large blur radii do cost paint time, so if you animate a shadow on hover, transition the opacity of a pseudo-element holding the shadow rather than the box-shadow value itself.
Is the shadow output from this tool valid everywhere?
The tool writes plain box-shadow longhand with px units and hex colors, which every current browser supports without prefixes. There's nothing proprietary in it, so it drops into vanilla CSS, Tailwind arbitrary values, or styled-components unchanged.
Can I use this as a css text shadow generator as well?
Not directly. This builds box-shadow, which sits behind the element's box, whereas a css text shadow generator would output text-shadow with offset-x, offset-y, blur, and color and no spread or inset. That said, the X, Y, blur, and color you dial here map straight onto text-shadow if you ignore the spread value.
Does the box shadow generator ship with css box shadow examples to copy?
There's no fixed gallery; you build the example live and copy it. The starting layer, 0 4px 12px at roughly 20 percent black, is a sensible baseline, and stacking a second wider, fainter layer gives you the kind of css box shadow examples that read as real elevation.
Is this css shadow generator aimed at UI elements specifically?
Yes. It's a css shadow generator tuned for interface work, which makes it a practical shadow generator for ui pieces like cards, dropdowns, modals, and buttons. The five-layer cap and per-layer inset toggle cover the depth patterns those components usually need.
Does the box shadow css online tool keep my work or send it anywhere?
Neither. This css box shadow generator online runs fully in the browser, so nothing uploads and nothing is stored. Build with the box shadow css online sliders, copy the line, and a refresh resets everything to the single default layer.

More CSS tools

View all