Home/Tools/Effects/Box Shadow Generator
Effects · Generator

Box Shadow Generator

Design complex box shadows with multiple layers, blur, spread, and color options.

Shadow Layers

Layer 1

0px
4px
20px
0px

Preview

Generated CSS
box-shadow: 0px 4px 20px 0px #00000020;
100%
Free, no
sign-up needed
0
Code written
by hand
85+
CSS tools
in one place
<1s
Copy-ready
CSS instantly
What is this

What is the CSS Box Shadow Generator?

Build single and layered CSS box shadows with visual controls. Set offset, blur, spread, colour, and inset, then copy the box-shadow value.

Everything runs locally in your browser. Adjust the controls above, preview instantly, and copy clean, production-ready CSS — no account, no upload.

How to use

Using the CSS Box Shadow Generator

Everything lives in the panel at the top of this page. There is nothing to install — it all runs right here in your browser.

1

Set offset, blur, and spread

Drag the X offset, Y offset, blur radius, and spread radius sliders. Positive Y offset casts the shadow below; negative above.

2

Set colour and opacity

Pick a shadow colour using the colour picker and adjust the alpha slider. For realistic shadows, use rgba with low alpha (0.05-0.2).

3

Add layers and copy

Click Add Layer to stack multiple shadows. Click Copy to grab the complete comma-separated box-shadow value.

The output

What the generated code looks like

Clean, production-ready CSS — no vendor bloat, no unnecessary declarations.

styles.css
/* Subtle card shadow */
.card {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Layered depth shadow */
.card-elevated {
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 4px 12px rgba(0, 0, 0, 0.08),
    0 16px 40px rgba(0, 0, 0, 0.06);
}

/* Coloured glow */
.btn-primary {
  box-shadow: 0 8px 24px rgba(108, 46, 245, 0.35);
}

/* Inset (inner shadow) */
.input:focus {
  box-shadow: inset 0 0 0 2px #6C2EF5;
}

Layer 2-3 shadows with different blur radii for realistic depth. A single sharp shadow looks flat on flat backgrounds.

Copy & paste

Ready-to-use CSS patterns

Drop any of these straight into your project — no modifications needed.

Subtle card

Minimal shadow for card components on white or light grey backgrounds.

styles.css
.card {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

Use at 0.06-0.10 alpha for white backgrounds.

Layered elevation

Three-layer shadow for realistically elevated surfaces, like a Material Design card.

styles.css
.elevated {
  box-shadow:
    0 1px 2px  rgba(0,0,0,0.04),
    0 4px 12px rgba(0,0,0,0.08),
    0 16px 40px rgba(0,0,0,0.06);
}

Stacked shadows look more realistic than a single large shadow.

Coloured brand glow

Glowing shadow in your brand colour for buttons and highlighted cards.

styles.css
.btn {
  box-shadow: 0 8px 24px rgba(108, 46, 245, 0.30);
}

Keep the alpha at 0.25-0.35 to avoid looking garish.

Inset focus ring

Inner shadow for focused inputs - avoids the layout shift of border-width changes.

styles.css
.input:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px #6C2EF5;
}

Inset shadows do not affect element dimensions or layout.

Pro tips

Pro tips for better results

Layer 2-3 shadows for realistic depth

Real shadows have a soft ambient component and a harder directional component. Use a small sharp shadow (low blur) plus a larger diffuse shadow (high blur) to mimic real lighting.

Keep shadow colour close to the surface background

Shadows on white backgrounds look best with rgba(0,0,0, 0.05-0.15). On dark backgrounds, slightly lighter transparent shadows. Pure black shadows at high opacity look unnatural.

Use box-shadow for focus rings instead of outline

box-shadow: 0 0 0 3px rgba(108,46,245,0.5) creates a rounded focus ring that follows border-radius. Unlike outline, it does not shift the layout.

Spread radius can create a border effect

box-shadow: 0 0 0 1px #e2e8f0 is a 1px border that does not affect layout dimensions - useful when you need a border that does not change element size.

FAQ

Frequently asked questions

Blur controls how soft or sharp the shadow edge is. A blur of 0 creates a hard-edged shadow. Spread expands or contracts the shadow size before blurring. A positive spread makes the shadow larger than the element.
Yes. Separate each shadow with a comma: box-shadow: shadow1, shadow2, shadow3. The first value is rendered on top. Use this to layer a sharp near shadow with a soft far shadow.
No. Everything runs in your browser. Nothing is sent to a server.

From the blog

Read more