Box shadow generator

Dial in a CSS box-shadow with live sliders and copy clean, ready-to-paste code.

Live preview
box-shadow: …;

How the box-shadow generator works

A CSS box-shadow paints a copy of an element's box behind (or inside) it, then shifts, scales and blurs that copy to fake the way real objects cast light. This tool exposes each part of the property as a slider, redraws the live card on every change, and prints clean, copy-ready CSS underneath. Because shadows are how interfaces communicate elevation, getting them right is the difference between a flat page and one with believable depth.

The five numbers map directly to what you see. Offset X and Y move the shadow; a small positive Y with no X reads as a light source directly overhead, which is the look most apps use. Blur softens the edge, spread grows or shrinks the footprint before the blur is applied, and the opacity slider sets the alpha of the colour so the background can show through.

A worked example

Suppose you want a card that gently lifts off the page. Set Offset X to 0, Offset Y to 8px, Blur to 24px, Spread to -4px and opacity to about 12%. The negative spread pulls the shadow in slightly so it stays tucked under the card instead of leaking out the sides, and the result is:

box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.12);

That single rule is what most "premium" card shadows boil down to: a low alpha, a blur roughly two to three times the vertical offset, and a touch of negative spread.

The five box-shadow parameters

ParameterEffectGood default
Offset XHorizontal shift (+ right, - left)0
Offset YVertical shift (+ down, - up)4px24px
Blur radiusEdge softness (higher is softer)~2× the Y offset
Spread radiusGrows / shrinks before blur0 or slight negative
Colour + alphaHue and transparency of the shadowrgba(0,0,0,0.1)

One tip that instantly improves a design: tint the shadow toward your background's hue rather than reaching for pure black. On a deep navy layout, a dark-blue shadow at low opacity feels cohesive, while flat grey looks pasted on. Toggle inset when you want the shadow drawn inside the box for recessed inputs, switches and wells.

Privacy note: this generator has no server and no analytics on your input. Every slider value and the CSS you copy are produced entirely on your device and exist only in this browser tab.

Frequently asked questions

What do the five box-shadow values mean?

In order: offset-x (horizontal shift), offset-y (vertical shift), blur-radius (how soft the edge is), spread-radius (how much the shadow grows or shrinks before blurring), and the colour. A positive offset-y pushes the shadow downward, which is what makes an element look like it is floating above the page.

Why use rgba() instead of a solid grey for the colour?

A translucent black lets the page background show through, so the shadow blends with whatever sits behind the element. A solid grey looks flat and muddy, and breaks the moment the background colour changes. Keeping the alpha between roughly 5% and 25% gives the soft, realistic look used by modern interfaces.

What is the inset option for?

Inset draws the shadow inside the element rather than behind it, which creates a pressed-in or recessed look. It is useful for input fields, toggles in their off state, and "well" containers. You can toggle it on here and the preview and CSS update instantly.

Can I stack more than one shadow?

Yes. CSS lets you separate multiple shadows with commas, and layering two or three with different blur and offset values produces far more natural depth than a single shadow. This generator focuses on crafting one well-tuned layer that you can copy and combine as needed.

Will a big blur radius slow down my page?

It can. The browser renders blur with a Gaussian filter, and very large blur values over many elements force expensive repaints, especially on mobile. Keep blur reasonable, avoid animating box-shadow directly, and animate opacity on a stacked shadow layer instead for smooth results.

Is anything I do here uploaded?

No. Every value is computed in your browser with plain JavaScript and CSS. Nothing about your shadow, colours, or settings is sent anywhere, logged, or stored.