Box shadow generator. Multi-layer, with presets.
Stack up to 5 shadow layers. Each layer has independent offset, blur, spread, color, and inset toggle. Live preview renders the shadow on a sample card. Copy the CSS or pick a starting preset (Material elevation 1-5, neumorphism, soft glow, retro hard).
Match your page background to preview the shadow in context.
// CSS appears here
Privacy: shadow generation happens in your browser. Nothing is sent or logged.
How to use the Box Shadow Generator
This generator builds a CSS box-shadow value from one or more stacked layers and shows it live on a white sample card. Each layer has its own offset, blur, spread, color, opacity and inset setting, and all layers are joined into one box-shadow line you can paste into a stylesheet. It is for designers and front-end developers setting the depth of cards, buttons and dialogs.
Step by step
-
Start from a preset
The page opens on Material 2, two soft black layers. Click Material 1, Material 2, Material 3 or Material 4 for a stepped elevation set, or Neumorphism, Soft glow, Retro hard or Brutalist for a styled look. A preset replaces every current layer. Neumorphism also sets the background to #e0d9c8 so the effect reads.
-
Set offset, blur and spread
Each card under Shadow layers has sliders for x and y offset (-50 to 50 px), blur (0 to 100 px) and spread (-50 to 50 px). Click the point on a slider's track where you want the value; the label above it shows the new number. Positive x moves the shadow right, positive y moves it down, and a negative spread shrinks the shadow before it is blurred.
-
Set color, opacity and inset
Paste a six-digit hex code such as #3f6b54 into the text field beside the layer's color swatch, then set opacity with the α slider, from 0 to 1 in steps of 0.05. Tick inset to draw that layer inside the card instead of outside it, which is how pressed buttons and inner borders are made.
-
Add or remove layers
Press + add layer to append a new layer that starts at 0 px x, 4 px y, 8 px blur and black at 0.15 opacity. Use the × on a layer card to delete it. The last remaining layer has no × and cannot be removed.
-
Match your page background
Set Background color to the color your element will sit on, with the picker or a hex code. Only the preview area changes, so you can judge the shadow in context. The background is not part of the CSS output.
-
Copy the CSS
Read the finished rule under CSS output and press copy CSS. The button briefly reads copied once the rule is on your clipboard.
Reading the CSS output
- The output is a single declaration. The default Material 2 preset gives box-shadow: 0px 3px 6px 0px rgba(0, 0, 0, 0.16), 0px 3px 6px 0px rgba(0, 0, 0, 0.23);
- Each comma-separated part is one layer, written as x offset, y offset, blur, spread and color, with the word inset in front when that box is ticked. Parts follow the order of the layer cards, and the first one is painted on top.
- Colors are always written as rgba values, so the opacity you set with the α slider is carried into the CSS.
Tips and common mistakes
- Dragging a slider moves it only one step, and an arrow key press moves it one step before the field loses focus, because the layer list redraws after every change. Click directly on the track at the value you want instead.
- Typing a color one character at a time does not work for the same reason. Paste the complete hex code in one go.
- Use full six-digit hex codes. A three-digit code such as #fff is read as black, so the shadow comes out darker than you expect.
- Neumorphism only reads well when the background is close to the card color. Other presets leave the background as it is, so reset Background color yourself after leaving Neumorphism.
- For a consistent design system, copy Material 1 through Material 4 in order and save them as your small, medium, large and extra large shadow tokens.
Privacy and limits
The shadow is built by JavaScript in your browser. Nothing you set is sent anywhere or saved, so reloading the page returns to the Material 2 preset. The copy button writes to your clipboard only when you press it.
Five elevation levels. Pre-decided so you don't.
Why elevation as a system. A button at rest needs a small shadow. The same button on hover needs a slightly larger one. A modal needs a much bigger shadow. If every shadow is one-off-tuned, the design feels inconsistent. If you decide the elevation levels up front (1, 2, 3, 4, 5) and use only those, every surface in the system feels related.
Material Design's contribution. Material Design codified elevation as five rest-states (1, 3, 6, 8, 12 dp above the surface) plus interactive elevations (raised, dragged, focused). Each level uses two stacked shadows, a tight close-shadow plus a softer ambient shadow. The math is publicly documented; we ship the canonical formulas as four of the presets above.
Modern brand systems. Most production design systems define 4-6 elevation tokens and reference them by name (shadow-sm, shadow-md, shadow-lg, shadow-xl). Tailwind ships five named elevations by default. Pick the level for each component once, then never tune individual shadows again.
The neumorphism question. The 2020-era trend uses a paired light + dark inset shadow to make UI elements look extruded from the same surface as the background. It produces beautiful screenshots and fails accessibility audits routinely, the contrast between element and background is intentionally low. Use it for accent visual elements (decorative cards, illustrative icons) but never for primary UI controls. Always pair with our Color Contrast Checker to verify the foreground text passes WCAG AA.
Four jobs this tool covers.
Job 1: Build a card-elevation set for a design system. Pick Material 1 through Material 4 in sequence, copy each CSS, paste into your design tokens as shadow-sm / shadow-md / shadow-lg / shadow-xl. The set comes pre-tuned for cohesion, using the four together makes every component in the system feel related.
Job 2: Design a button rest + hover + active state. Build a small shadow for rest (Material 1), tune up for hover (Material 2), tune down with inset for pressed-active. Three CSS strings, paste into :hover and :active selectors. The shadow shift is what gives the button its tactile feel.
Job 3: Modal / dialog overlay shadow. Modals and bottom sheets need much bigger shadows than cards, they're meant to feel "above" the page rather than embedded in it. Material 4 is the right starting point; soft glow with a brand-color tint adds personality without losing professional polish. Pair with our Gradient Generator for the modal background.
Job 4: Brand-distinctive depth. Generic Material shadows look like generic SaaS. To make depth feel branded, tint the shadow with a color from your palette instead of pure black. Soft glow with a 30% moss tint reads as warmer than black; soft glow with a 30% amber tint reads as warmer still. Subtle, but it's what separates "tech-template" depth from "considered design system" depth.
Six questions users ask.
Why stack multiple shadow layers?
Real-world shadows are never one uniform blur. A floating object casts a tight close shadow plus a softer ambient shadow plus often a colored bounce shadow from nearby surfaces. Material Design codified this, every elevation level is two stacked shadows. Modern brand systems (Stripe, Linear, Vercel) layer 3-4 shadows for premium-feeling depth. A single shadow always reads as cheap or generic; layered shadows look considered.
What are the four shadow parameters?
Offset-X moves the shadow horizontally (positive = right). Offset-Y moves it vertically (positive = down, the natural drop direction). Blur radius softens the edge (0 = hard edge, 100 = very diffuse). Spread expands or contracts the shadow before blurring (positive = larger than the source, negative = smaller). Color sets the shadow tint, usually a translucent black like rgba(0,0,0,0.15). Inset reverses the shadow to render inward, used for inset borders and pressed-button states.
What's neumorphism?
A 2020-era design trend that uses a paired inset shadow, one light from the top-left, one dark from the bottom-right, to make UI elements look extruded from the same surface as the background. Built into the preset list. Falls out of accessibility favor because the contrast between element and background is intentionally low; shipping neumorphism as your primary UI risks WCAG failures. Use sparingly for accent elements; pair with our Color Contrast Checker to verify foreground text passes AA.
Material Design elevation, what do the levels mean?
Material Design specifies elevation as a vertical distance in dp (density-independent pixels) above the surface. Level 1 (~1dp) is for cards and chips at rest. Level 2 (~3dp) is for raised buttons. Level 3 (~6dp) is for picked-up cards mid-interaction. Level 4 (~8dp) is for FABs and snackbars. Level 5 (~12dp) is for modal sheets and dialogs. Each level is rendered as two stacked shadows, a tight close-shadow plus a softer ambient shadow. The presets here implement the canonical Material formula.
How do shadows affect performance?
CSS box-shadow is GPU-accelerated in modern browsers, the rendering cost is similar to a transparent element. The performance concern is animating shadow properties (offset, blur, spread) which forces a repaint per frame. For animated state changes, use opacity or transform on a pseudo-element instead, or use the will-change hint sparingly. For static shadows, no measurable performance cost on any modern device. Layer count up to ~10 has negligible impact.
Is the shadow I build sent anywhere?
No. Generation happens entirely in your browser. The page is static HTML; the only network request is the initial page load. Safe for unpublished design system explorations or any color choices you don't want shared with a third party.
Published · Last updated .