DESIGN SYSTEMS & CODE

Smooth Layered Box-Shadow Generator

Build realistic, non-muddy elevation shadows by stacking multiple layers that fade like real ambient light — then export a synchronized xs–2xl elevation scale.

3–6 Layer Shadow StackingPhysically-Inspired Easing CurvesSynchronized xs–2xl Elevation ScaleCSS Variables & Tailwind Export
Elevation presets

Live Preview

box-shadow
XS
SM
MD
LG
XL
2XL
:root {
  --shadow-xs: 0px 3px 4px 0px rgba(15, 23, 42, 0.108), 0px 5px 7px -1px rgba(15, 23, 42, 0.07), 0px 6px 8px -1px rgba(15, 23, 42, 0.048), 0px 6px 9px -1px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0px 5px 6px -1px rgba(15, 23, 42, 0.108), 0px 8px 11px -1px rgba(15, 23, 42, 0.07), 0px 10px 14px -1px rgba(15, 23, 42, 0.048), 0px 10px 15px -1px rgba(15, 23, 42, 0.04);
  --shadow-md: 0px 7px 10px -1px rgba(15, 23, 42, 0.108), 0px 12px 17px -1px rgba(15, 23, 42, 0.07), 0px 15px 21px -2px rgba(15, 23, 42, 0.048), 0px 16px 22px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0px 11px 16px -1px rgba(15, 23, 42, 0.108), 0px 19px 27px -2px rgba(15, 23, 42, 0.07), 0px 24px 34px -3px rgba(15, 23, 42, 0.048), 0px 26px 36px -3px rgba(15, 23, 42, 0.04);
  --shadow-xl: 0px 17px 24px -2px rgba(15, 23, 42, 0.108), 0px 29px 40px -4px rgba(15, 23, 42, 0.07), 0px 36px 50px -4px rgba(15, 23, 42, 0.048), 0px 38px 54px -5px rgba(15, 23, 42, 0.04);
  --shadow-2xl: 0px 24px 33px -3px rgba(15, 23, 42, 0.108), 0px 41px 57px -5px rgba(15, 23, 42, 0.07), 0px 51px 71px -6px rgba(15, 23, 42, 0.048), 0px 54px 76px -7px rgba(15, 23, 42, 0.04);
}
Current box-shadow (single value)
Shadow & Elevation Guide

Why Layered Shadows Look More Realistic

A single CSS box-shadow has exactly one blur radius, so its edge fades at a constant rate — which reads as flat and slightly artificial. Real shadows don't fade evenly: light sources aren't points, so the soft edge (the penumbra) spreads and fades faster than the dark core (the umbra) grows. Stacking several shadow layers — each with a larger offset and blur but lower opacity than the last — approximates that natural falloff far better than any single blur value can.

Light / Shadow Angle

Controls the direction the shadow is cast, measured clockwise from the top: 0° casts the shadow straight up, 90° to the right, 180° straight down (the natural default for a card lit from above), and 270° to the left.

Layers & Elevation Distance

More layers produce a smoother gradient of blur and opacity — 3 layers reads as a clean UI shadow, 6 reads as a soft, photographic falloff. Distance sets how far the farthest, softest layer travels — effectively how "high" the element floats above the page.

Falloff Curve (Easing)

Linear spaces layers evenly. Smooth Diffusion pushes layers out quickly and lets the tail ease off gently — the most "ambient occlusion" looking option. Sharp Focus keeps early layers tight together for a crisp core, with one dramatic long layer at the end.

Blur Intensity, Spread & Opacity

Blur Intensity scales blur relative to each layer's offset — higher values look softer and more diffuse. Negative Spread pulls the shadow's edges in slightly, which keeps large shadows from looking like a blurry rectangle. Opacity sets how dark the closest, sharpest layer is; every layer after it fades further automatically.

How the xs–2xl Elevation Scale Is Derived

Rather than asking you to configure six shadows by hand, this tool treats your current settings as the MD baseline and scales the distance and spread up or down for each level — while keeping the same angle, color, layer count, and falloff curve. That's what keeps an entire elevation system looking like one consistent light source instead of six unrelated shadows.

XS = 0.4× distanceSM = 0.65× distanceMD = 1× distanceLG = 1.6× distanceXL = 2.4× distance2XL = 3.4× distance

Step-by-Step: How to Use This Generator

01

Start from a preset

Subtle Card, Raised Button, Modal / Dialog, and Dramatic Hero cover the most common elevation use cases — pick the closest one as a starting point.

02

Set your light direction and distance

180° (light from above) is the standard default. Increase Elevation Distance for elements that should feel like they're floating higher above the page.

03

Pick a falloff curve

Smooth Diffusion for soft, modern UI. Sharp Focus for a more dramatic, high-contrast shadow with a long soft tail.

04

Tune color and opacity to your background

Shadows on a colored or dark background often look better tinted (a dark navy instead of pure black) rather than just darkened.

05

Export the full scale

Copy the CSS custom properties or Tailwind boxShadow config — six synchronized tokens (xs through 2xl), ready to drop into your design system.

Frequently Asked Questions

Why not just use one box-shadow with a bigger blur?

A single blur value fades at a constant rate, which looks flat and can turn muddy at large sizes. Multiple layers with decreasing opacity mimic how real ambient light actually falls off — sharper near the object, softer and fainter further away.

Why is my shadow color a dark navy instead of black?

Pure black shadows can look harsh and disconnected from a colored background. A very dark, slightly saturated color (like #0F172A) tends to blend more naturally — most of the built-in presets use this instead of #000000.

What does negative spread do?

Spread grows or shrinks the shadow's box before blurring. A small negative spread (like -2px to -6px) keeps large, soft shadows from reading as a blurry rectangle by pulling their edges in slightly first.

How many layers should I use?

3–4 layers is plenty for small UI elements like buttons and cards. Reach for 5–6 layers on large, dramatic elevation — like a modal or a hero image — where the extra layers produce a noticeably smoother gradient.

Will this work with Tailwind's default shadow scale?

The exported boxShadow config adds new keys (xs, sm, md, lg, xl, 2xl) to your theme.extend.boxShadow, so it layers on top of Tailwind's defaults rather than replacing them — use shadow-md, shadow-lg, etc. as normal.

UI Pirate Ecosystem

Suggested Tools for Your Stack

Explore related utilities in this workflow or discover cross-category tools.

View All Tools →