Skip to main content

Free CSS Box Shadow Generator — Multi-Layer, Inset & Outset, Live Preview

Compose realistic, production-grade CSS box-shadow values with up to eight stacked layers, per-layer offset, blur, spread, color, alpha, and inset control. Switch the preview between light, dark, and checker surfaces and across card, button, pill, circle, and square shapes. Export to CSS, Tailwind v4, SCSS, CSS custom property, React inline style, or filter:drop-shadow(). 100% client-side — nothing is uploaded.

25+ presetsUndo / redoImport & export JSONKeyboard shortcutsZero ads

Live Preview

Preview

Shadow Layers (1/8)

Layer 1

Offset X0px
Offset Y8px
Blur24px
Spread-8px

Presets

CSS Box Shadow Generator Features

Up to 8 Stacked Layers

Real elevations are not one shadow — Material Design and Tailwind use 2–3 layered shadows at different blur radii for natural depth. Add up to 8 independent layers and reorder them.

Full Property Control

Offset-x, offset-y, blur, spread, color, alpha, inset — every CSS box-shadow property exposed as a labelled slider plus a precise numeric input. No mental math required.

25+ Curated Presets

Tailwind sm/md/lg/xl/2xl, Material 2dp/4dp/8dp/16dp/24dp, neumorphic light/dark/pressed, glass card, focus ring, brutalist, long shadow, brand glow, and more — filterable by category.

7 Output Formats

Copy as raw CSS value, full declaration, Tailwind v4 arbitrary value, SCSS variable, CSS custom property, React inline style object, or filter:drop-shadow() equivalent.

Undo, Redo & History

Every change is captured in a 40-step history stack. Step backward and forward through your iterations safely — perfect for design exploration without losing prior states.

Randomize, Reset & JSON

Generate a balanced random shadow as a starting point, reset to defaults in one click, or export the full configuration as JSON to share with teammates and re-import later.

Keyboard Shortcuts

Ctrl/Cmd+Z to undo, Ctrl/Cmd+Shift+Z (or Ctrl+Y) to redo. Numeric inputs accept arrow keys and step values for fine-grained adjustments. Built for design-system workflows.

100% Client-Side

No upload, no save. Your brand elevation tokens and pre-launch design experiments stay entirely on your device — safe for confidential and NDA work.

The Multi-Layer CSS Box Shadow Generator for Realistic Elevation

A flat, single-layer drop shadow is the giveaway of an unrefined UI. Real elevation — the kind you see in Material Design 3, Tailwind's shadow scale, and modern glass-morphism — uses two or three layered shadows at different blur radii to mimic how light actually wraps around an object. Our Free Online CSS Box Shadow Generator is built for that workflow: up to eight independent layers, each with its own offset, blur, spread, color, alpha, and inset state, plus a live preview on real card, button, pill, and circle surfaces — on light, gray, dark, and transparent-checker backgrounds — so you see exactly what ships.

The CSS box-shadow property is formally defined in CSS Backgrounds and Borders Module Level 3 by the W3C, and is documented for working developers on MDN Web Docs. This tool encodes the entire specification — including the multi-layer comma syntax, the inset keyword, negative spread, and alpha blending — into a live preview so you never have to re-read the grammar.

Use this generator alongside our CSS Gradient Generator (for background fills under your shadowed cards), the Color Palette Generator (to source brand-aligned shadow colors), the Border Radius Generator (rounded corners change the visual weight of a shadow significantly), the Glassmorphism Generator (for translucent panels that need elevation), and the CSS Minifier to ship clean production tokens. When you are done, validate text contrast on top of your shadowed cards with the Color Contrast Checker.

How to Generate a CSS Box Shadow in 6 Steps

  1. 1

    Pick a preset as a starting point

    Open the Presets panel and filter by category — Tailwind, Material, Neumorphic, Glow, Glass, or Special. Click a preset thumbnail to load its full multi-layer configuration into the builder.

  2. 2

    Adjust each layer to taste

    Drag the Offset X/Y, Blur, and Spread sliders, or type exact values into the numeric inputs. Pick a shadow color from the swatch, then dial the Alpha slider to control how much of the background shows through.

  3. 3

    Stack additional layers if needed

    Click Add Layer to stack up to eight shadows. Use the up / down arrows on each layer to control paint order — later layers paint above earlier ones. Toggle the Inset checkbox for any layer that should paint inside the box.

  4. 4

    Validate the result against real surfaces

    Switch the preview surface between Light, Gray, Dark, and Checker. Black shadows that look perfect on Light usually vanish on Dark — adjust the color or alpha until the elevation reads on every background you target.

  5. 5

    Switch the preview shape

    A shadow that looks balanced on a card may feel heavy on a button, pill, or circle. Toggle between the five preview shapes to confirm the elevation reads correctly at the size and curvature it will ship at.

  6. 6

    Copy in your target format

    Pick CSS declaration, raw CSS value, Tailwind v4 arbitrary class, SCSS variable, CSS custom property, React inline style, or filter:drop-shadow(). Click Copy and paste into your codebase. Use Export JSON to share the exact configuration with a teammate.

CSS Box Shadow Property Reference

The shorthand grammar per W3C CSS Backgrounds Level 3: [inset?] <offset-x> <offset-y> <blur> <spread> <color>.

ValueWhat It DoesTypical Range
insetPaint inside the box instead of outsideUse for pressed buttons, inner highlights
offset-xHorizontal displacement−10 to 10 px (often 0 for natural light)
offset-yVertical displacement1 to 20 px (positive = below the box)
blur-radiusSoftness of the shadow edge2 to 50 px (higher = softer)
spread-radiusGrow or shrink the shadow before blurring−8 to 4 px (negative = tighter contact)
colorShadow color (use rgba for alpha)Black at 5–25% alpha is the safe default

Elevation Scale: Tailwind vs Material vs Apple

Each major design system uses a small, opinionated set of elevations rather than arbitrary values. Picking from this scale — and applying it consistently — is more important than the exact pixel values you choose. Use the table below to map a UI surface (button, card, modal) to a sensible elevation level.

SurfaceTailwindMaterialApple HIG-style
Resting cardshadow-smelevation 1dpnone (border only)
Hover cardshadow-mdelevation 4dpvery soft drop
Dropdown / menushadow-lgelevation 8dpsoft drop + thin border
Dialog / modalshadow-xl / 2xlelevation 16–24dplarge soft drop + scrim
Pressed buttonshadow-innerinset 2dpinset darken
Focus ringring-2 ring-offset-2accent glowaccent halo

The Three-Layer Recipe Real Design Systems Use

Look closely at any Material Design or Tailwind card and you will see not one shadow but several stacked together. This is how light actually behaves: a tight contact shadow underneath, a softer ambient shadow extending outward, and (for higher elevations) an atmospheric layer that suggests distance from the page. To reproduce this in our generator, click Add Layer twice after loading the default preset, then set each layer using the table below.

1. Contact Shadow

Small offset (1–2px), tight blur (2–4px), negative spread (−1px). Creates the "sitting on the surface" feel.

2. Ambient Shadow

Medium offset (4–10px), moderate blur (6–15px), modest spread (0–−3px). Provides the broader "floating just above" depth that reads as elevation.

3. Atmospheric (optional)

Large offset (10–20px), large blur (20–40px), very low alpha. Adds a sense of distance from the page surface — reserve for hero cards, modals, and floating action sheets.

box-shadow vs filter: drop-shadow() — When to Use Which

Both properties paint a shadow, but they follow different shapes. The box-shadow property follows the element's border-box — a rectangle, or a rounded rectangle if you have a border-radius set. The filter: drop-shadow() function paints a shadow that follows the element's actual rendered silhouette — including transparent PNG cutouts, SVG paths, and the gaps between letters of text.

PropertyBest forSupports inset?Supports spread?Follows shape?
box-shadowCards, buttons, panels, modalsYesYesBorder-box only
filter: drop-shadow()Icons, SVGs, transparent PNGs, textNoNoActual silhouette

Our generator exports both formats. The filter: drop-shadow() output skips inset layers (the function has no inset equivalent) and concatenates remaining layers with spaces, per MDN's drop-shadow() reference.

Performance: Keeping Box Shadows Cheap at 60fps

Box-shadow is GPU-accelerated for the initial paint, but any change to its value triggers a fresh paint on every affected pixel — including large blurred regions. On a list of fifty cards each with a 40px-blur shadow, even a slight color change can stall the main thread for several frames. The fix is to never animate box-shadow directly. Instead, render two pre-baked shadow states and crossfade between them by animating opacity:

.card { position: relative; box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
.card::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  box-shadow: 0 10px 30px rgba(0,0,0,0.12);
  opacity: 0;
  transition: opacity 200ms ease;
  pointer-events: none;
}
.card:hover::after { opacity: 1; }

Other production tips: stick to opacity and transform for animation, set will-change: transform only on the elements that need it, and minify your final stylesheet with our CSS Minifier so long shadow declarations don't bloat your bundle. For a complete view of browser repaint behaviour, see Google's web.dev animation guide.

Accessibility: Shadows Are Not Borders

A shadow alone is not a reliable boundary signal for users with low vision, high-contrast mode enabled, or forced-colors active. Windows High Contrast Mode strips all box-shadow values to nothing, so any UI that relies on shadows to communicate structure breaks instantly. Defensive practice: always pair a meaningful shadow with a 1px solid borderthat uses a real color token, not transparent or rgba(0,0,0,0.05).

When the shadow itself is the focus indicator (the common :focus-visible ring pattern), make sure the ring meets the WCAG 2.2 focus appearance requirements: at least a 2×2 CSS pixel area of contiguous contrast and a contrast ratio of at least 3:1 against adjacent colors. Use our Color Contrast Checker to verify the focus ring color against both the card surface and the page background.

Browser Support

box-shadow has been a fully supported, unprefixed CSS property in every major browser for over a decade. No fallbacks, polyfills, or vendor prefixes are required for the syntax this generator emits.

FeatureChromeFirefoxSafariEdge
box-shadow (basic)10+4+5.1+12+
Multi-layer (comma)10+4+5.1+12+
inset keyword10+4+5.1+12+
filter: drop-shadow()18+35+9+12+

Common Shadow Pitfalls (and How We Fix Them)

1. Over-Dark Shadows on Light UI

Black at 50% alpha screams "noughties web design." Modern UI uses black at 5–15% alpha for most elevations. Less is more.

2. Black Shadow on Dark Mode

Black shadows disappear into dark backgrounds. Use a brand-color glow at low alpha, or an inset white highlight to indicate elevation. Use the Dark preview surface above to test.

3. No Negative Spread

Without negative spread, large-blur shadows feel disconnected from the box. A −4 to −8 spread pulls the shadow tight to the box for that elevation feel.

4. Same Shadow at Every Elevation

A modal should not have the same shadow as a button. Define an explicit elevation scale (sm/md/lg/xl) and apply consistently across components.

5. Animating box-shadow Directly

Animating the property forces paint on every frame. Render a second shadow on a pseudo-element and crossfade with opacity instead — the GPU handles it for free.

6. Relying On Shadow For Boundary

Windows High Contrast Mode strips all shadows. Always pair a meaningful shadow with a 1px solid border using a real color token to keep card boundaries visible.

Frequently Asked Questions

How do I make a CSS box shadow with multiple layers?+

Separate each shadow with a comma inside a single box-shadow declaration. Earlier layers paint underneath later ones. Click Add Layer in the builder above to stack up to eight layers, then reorder with the up/down arrows.

What is the difference between inset and outset (regular) shadows?+

A regular (outset) shadow paints outside the box, suggesting elevation. An inset shadow paints inside the box, suggesting a recessed surface — perfect for pressed buttons and inner glows. Toggle the Inset checkbox on any layer.

How is blur different from spread?+

Blur softens the shadow edge; higher values produce more diffuse edges. Spread grows or shrinks the shadow uniformly before blurring — negative spread tightens the shadow to the box.

Why does my shadow disappear on a dark background?+

Black shadows rely on contrast with light surfaces. On dark backgrounds they vanish. Lower the alpha further or switch to a colored glow at low alpha. Use the Dark preview surface above to test.

Does box-shadow work in every browser?+

Yes. box-shadow has been unprefixed and fully supported in Chrome 10+, Firefox 4+, Safari 5.1+, Edge 12+, and all modern mobile browsers since 2012.

How do I use the Tailwind v4 output?+

Tailwind v4 supports arbitrary CSS values via shadow-[…] bracket notation. Our exported class is escape-safe — spaces become underscores and commas are preserved correctly. Paste it onto any element.

Can box-shadow degrade performance?+

Yes. Animating box-shadow directly forces a paint on every frame. Use a pseudo-element with a pre-baked shadow and animate opacity instead. Stick to transform and opacity for the animation itself.

What is the difference between box-shadow and filter: drop-shadow()?+

box-shadow follows the border-box (a rectangle). filter: drop-shadow() follows the actual rendered silhouette — great for icons, SVGs, and transparent PNGs. Our generator exports both formats.

Is my shadow configuration sent to your server?+

No. The generator runs entirely client-side. Color values, alpha levels, exported CSS strings, and imported JSON files never reach our servers.

Last updated: June 10, 2026 · Runs 100% in your browser — no uploads, nothing leaves your device.

Need a different tool?

Browse all 89 free, in-browser tools — or tell us what we should build next.

Browse all tools