Box Shadow Generator

Shadows sell depth. Drag the sliders for offset, blur, spread, color and opacity, watch the shadow land on a real box, and copy CSS that is already formatted and ready to ship.

1Drag the sliders
2Check the live preview box
3Copy the CSS
Inset (shadow inside the box)

Presets

Preview box
box-shadow: 10px 10px 20px 0px rgba(0, 0, 0, 0.3);

Private by design: 100% in your browser — nothing is uploaded, no sign-up. This tool runs entirely on your device.

How to use this box shadow generator

Every slider maps to one part of the box-shadow syntax, and the preview box in the middle of the page wears the shadow you are building, on a tinted stage so both dark and light shadows stay visible. Horizontal and vertical offset move the shadow around; blur softens it; spread grows or shrinks it before the blur; opacity and color decide how present it feels; and the inset toggle flips the shadow inside the box for pressed, carved-in effects. The CSS line under the stage rewrites itself on every movement, in the exact order browsers expect, with the color expressed as rgba() so the opacity you chose travels with it.

If you are starting from zero, begin with a preset rather than a blank slate. Soft card is the everyday workhorse of modern interfaces; Floating modal shows how much blur and lift a dialog needs before it feels detached from the page; Bottom only demonstrates the negative-spread trick that keeps a card's sides clean. Load one, then drag — small movements, checking the preview each time. Shadows are seasoning: the moment you can describe the shadow before noticing anything else on the box, dial it back a third.

When the shadow looks right, copy the declaration and paste it into your element's rule. For a layered, realistic depth effect, run the generator twice — once for a small, darker contact shadow, once for a large, faint ambient one — and join the two values with a comma in a single box-shadow property. That two-shadow recipe is the open secret behind the soft, expensive-looking cards in every major design system.

Example: the default shadow, decoded

This page opens with a balanced, general-purpose shadow:

box-shadow: 10px 10px 20px 0px rgba(0, 0, 0, 0.3);

Read it left to right: the shadow is shifted 10 pixels right and 10 pixels down, as if lit from the upper left; its edge is blurred over 20 pixels, so it fades rather than steps; the spread is 0, meaning the shadow keeps the box's own size before blurring; and its color is black at 30% opacity, darkening whatever lies beneath instead of painting grey over it. Change any single ingredient and the character changes with it — zero blur with full opacity becomes the hard retro preset, a style in its own right.

Shadows as a depth system

Professional interfaces do not invent a shadow per element; they define a small ladder of elevations — resting card, raised card, dropdown, modal, toast — and give each rung a fixed shadow. Consistency is what makes the depth believable: two elements with the same shadow read as floating at the same height, and users learn the ladder without ever being told. When you build your own system, define three to five shadows with this generator, name them as variables (--shadow-sm, --shadow-md, --shadow-lg), and forbid improvisation. The other rule of the ladder: height is shown by blur and offset growing together, never by opacity alone — a shadow that only gets darker looks dirtier, not higher.

Colored shadows and other refinements

Black is the default because real shadows are the absence of light, but a shadow tinted with the element's own color can feel richer — a blue button casting a faint blue-grey shadow sits more naturally on a white page than one casting neutral grey. The color picker here makes that a ten-second experiment: sample your element's color, drop the opacity to 20–30%, and compare. Keep the effect subtle and keep it systematic — tint shadows for colored elements of the same family, neutral for everything else. And remember the accessibility angle: a shadow is decoration, never information. If removing every shadow from your interface would hide something a user needs — a boundary, a state, a separation — that thing deserves a border or a background as well.

Frequently asked questions

What do the four box-shadow numbers mean?

In order: horizontal offset (how far the shadow slides right, or left when negative), vertical offset (down, or up when negative), blur radius (how soft the edge is — 0 is a hard-edged copy of the box), and spread radius (how much the shadow grows or shrinks before blurring). After the numbers comes the shadow's color.

What does the inset option do?

A normal shadow falls outside the box, as if the box were lifted above the page. Adding the inset keyword turns the shadow inward, darkening the inside edges — the look of a pressed button, a well or an input field carved into the surface. Inset shadows are the standard trick for realistic form fields.

Why use rgba() with opacity instead of a solid shadow color?

A semi-transparent shadow darkens whatever sits beneath it, so it looks natural on white, grey and colored backgrounds alike. A solid grey shadow only looks right on the one background it was tuned for. That is why this generator expresses the shadow color as rgba() with an opacity you control.

Can an element have more than one shadow?

Yes — separate shadows with commas and the browser paints them all, first on top. Layering a small, darker shadow under a large, soft one is how designers fake realistic depth: the tight shadow reads as contact with the surface, the wide one as ambient light being blocked. This generator builds one shadow at a time; copy two results and join them with a comma.

What shadow values look natural?

Light in interfaces comes from above, so keep the vertical offset positive and larger than the horizontal. Small elements want small, tight shadows — a few pixels of blur at 15–25% opacity. Large floating elements like modals earn bigger blur and softer opacity. When a shadow is the first thing you notice, it is too strong.

What does a negative spread do?

Negative spread shrinks the shadow before it blurs, pulling it in from the sides. Combined with a positive vertical offset, it produces the popular effect where a soft shadow appears only beneath the bottom edge of a card, with clean sides. Positive spread does the opposite, fattening the shadow on all sides.

Does box-shadow follow border-radius?

Yes. The shadow is cast by the element's border box including its rounded corners, so a pill-shaped button casts a pill-shaped shadow. It does not follow the shape of transparent images, though — for that you need the drop-shadow() filter, which traces the visible pixels.

Do box shadows hurt performance?

A static shadow costs almost nothing. Huge blur radii on huge elements, and especially animating a shadow, force the browser to repaint expensively every frame. If you need a shadow that moves, animate a pseudo-element's opacity instead — or keep animations to transform and opacity, which stay cheap.

Is anything I create uploaded or tracked?

No. The preview and the CSS are generated by JavaScript in your own browser. Settings you choose are never sent to a server or stored anywhere — closing the tab clears everything.

Related tools