# CSS Box Shadow Generator

> Stack shadow layers with sliders, preview them on light and dark surfaces, and copy the box-shadow as CSS, Tailwind or a drop-shadow() filter.

- Page: https://codethatmoves.com/tools/motion/box-shadow-generator/
- Site: Code That Moves
- Category: Motion and CSS
- Free, runs in the browser, nothing is uploaded
- Last checked: 2026-11-03

## What it does

- Multiple box-shadow layers with offset, blur, spread, colour, opacity and inset
- Reorder, duplicate and hide layers
- Live preview on light, dark, coloured or your own surface, with box width and corner radius
- A smooth layered shadow builder and nine presets, including a neumorphic one
- An elevation set: sm, md and lg shadows from one light direction, tinted to the background, as CSS variables or a Tailwind v4 @theme block
- Paste an existing box-shadow value to load and edit it: any CSS colour, px, rem or em
- Copy as CSS, a Tailwind arbitrary class or a filter: drop-shadow(), with a share link

## How to use it

1. Pick a preset or start from the default layer, then move the sliders for offset, blur, spread and opacity, and choose a colour.
2. Add more layers to build depth. Select a layer in the list to edit it; the preview updates as you go.
3. Copy the CSS, the Tailwind class or the drop-shadow() version. To change a shadow you already have, paste it into the edit box and load it.
4. For a design system, set the light direction and strength in Elevation set and copy the three tokens.

## What it checks and why

A box-shadow layer has an x and y offset, a blur radius, an optional spread and a colour, and the inset keyword moves it inside the box. A comma-separated list stacks layers, with the first one drawn on top. Blur cannot be negative; spread can, which pulls the shadow in so it shows only below the box.

One large blurred shadow tends to look flat. Stacking several layers whose offset and blur double each step, each with a small share of the opacity, gives a soft falloff closer to a real shadow. The smooth layered builder writes that stack for you from a layer count, a distance and a total opacity.

The tool writes colours as rgb() with a slash alpha, the modern syntax every current browser supports. The drop-shadow() output follows the alpha of transparent images and SVGs instead of the box, but the filter has no spread and no inset, so the tool tells you which parts it had to leave out.

Shadows in one interface should look lit by the same lamp. The elevation set gives three tokens that share a light direction, grow longer and softer as the element rises, and take a dark tint of the background hue instead of plain grey, which reads as a real shadow on coloured surfaces.

## Specs and sources

- [W3C: CSS Backgrounds and Borders, box-shadow](https://www.w3.org/TR/css-backgrounds-3/#box-shadow)
- [MDN: box-shadow](https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow)
- [MDN: drop-shadow()](https://developer.mozilla.org/en-US/docs/Web/CSS/filter-function/drop-shadow)
- [Tobias Ahlin: Smoother and sharper shadows with layered box-shadows](https://tobiasahlin.com/blog/layered-smooth-box-shadows/)
- [Tailwind CSS: box-shadow and arbitrary values](https://tailwindcss.com/docs/box-shadow)

## Limits

- Lengths are written in px. The edit box reads rem and em as 16px, and any colour the browser understands, but not CSS variables.
- Many large blurred layers cost paint time, more so when they animate. Animate the opacity of a pseudo-element that holds the shadow instead of the shadow itself.
- drop-shadow() draws differently from box-shadow on boxes with rounded corners and transparent parts, so check the filter version in your own layout.

## Questions

### What do the four box-shadow values mean?

In order: horizontal offset, vertical offset, blur radius and spread radius, followed by the colour. Only the two offsets are required; blur and spread default to 0.

### How do I add more than one shadow?

Separate the layers with commas in one box-shadow declaration. The first layer is painted on top. The generator writes each layer on its own line so the list stays readable.

### How do I make a shadow only on the bottom?

Give it a positive y offset and a negative spread about as large as the blur, for example 0 12px 12px -12px. The spread pulls the shadow in at the sides so only the bottom edge shows.

### What is the difference between box-shadow and drop-shadow?

box-shadow follows the element's box and border radius. filter: drop-shadow() follows the visible pixels, so it hugs transparent PNGs and SVG shapes, but it has no spread and no inset.

### How do I write a custom shadow in Tailwind?

Use an arbitrary value: shadow-[0_8px_24px_-4px_rgb(15_23_42_/_0.18)]. Spaces become underscores. The generator writes that class for you from the current layers. For a set of shadows, copy the Elevation set as a Tailwind v4 @theme block, which redefines shadow-sm, shadow-md and shadow-lg.

### How do I make a soft, realistic shadow?

Stack several layers instead of one big blur: each layer doubles the offset and blur of the one before and gets a small share of the opacity. Use the smooth layered builder, and tint the shadow towards the background colour rather than pure black.

### How do I make a neumorphism shadow?

Give the box the same colour as the page and add two shadows: a dark one offset down and right, and a light one offset up and left. The Neumorphic preset does that; pick the Custom surface to set the page and box colours.

### Is it bad for performance to animate box-shadow?

Animating box-shadow repaints the element on every frame. Put the shadow on a pseudo-element and animate its opacity instead, which the browser can run on the compositor.
