What is a CSS box-shadow generator?
A box-shadow generator builds the box-shadow value for you. The property draws one or more shadows behind (or inside) the box of an element. Each shadow has a horizontal offset, a vertical offset, a blur, an optional spread, a color and an optional inset keyword. Writing that by eye is slow, because you have to change a number, reload and look again. This tool shows the shadow live and writes the CSS as you move the sliders.
Good shadows are usually subtle, and most of them use several layers. A single heavy shadow looks flat and dirty. Two or three light layers with growing offset and blur look like real light. That is why the tool is built around layers: you add as many as you want and edit each one on its own.
The preview shows a sample box on a light and on a dark background, because the same shadow looks very different on each. You can copy plain CSS or a Tailwind arbitrary-value class. You can also paste a box-shadow you already have and keep editing it. The tool runs in your browser and nothing you type or paste is sent anywhere.
How to build a box-shadow
- Pick a look in "Starting points" (Soft, Layered, Hard offset, Inner, Glow or Lifted), or paste a declaration into "Paste CSS to edit it".
- Edit "Layer 1". "Horizontal offset" and "Vertical offset" move the shadow in pixels (negative values go left and up). "Blur" softens the edge. "Spread" grows or shrinks the shadow before blurring.
- Choose the "Color" and its "Opacity". A low opacity of black is the most natural shadow.
- Tick "Inner shadow (inset)" to draw the shadow inside the box instead of outside.
- Press "Add a layer" to stack another shadow. It starts as a copy of the last one, two pixels lower and four pixels blurrier. Use "Remove" to delete a layer. With no layers the result is
none. - Use "Corner radius of the sample" to match the rounding of your real element, and check both backgrounds in the preview.
- Pick "CSS" or "Tailwind" under "Format" and press "Copy CSS".
Examples
A soft card shadow
The default Soft look gives a shadow that is easy to reuse on cards:
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);The Tailwind format writes the same value with underscores in place of spaces:
shadow-[0_4px_12px_rgba(0,_0,_0,_0.15)]A hard offset shadow
The Hard offset look has no blur, which gives a flat, graphic effect:
box-shadow: 6px 6px 0 #141413;Zero values are written as 0 with no unit, and a color with full opacity stays as hex.
Inner and lifted shadows
Inner uses inset to look like a pressed field:
box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.35);Lifted uses a negative spread, so the shadow is narrower than the box and shows only underneath, like a card floating above the page:
box-shadow: 0 18px 30px -12px rgba(0, 0, 0, 0.45);Layered shadow and paste
The Layered look stacks five light layers, each double the previous offset and blur. The tool writes one layer per line:
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12),
0 2px 2px rgba(0, 0, 0, 0.12),
0 4px 4px rgba(0, 0, 0, 0.12),
0 8px 8px rgba(0, 0, 0, 0.12),
0 16px 16px rgba(0, 0, 0, 0.12);If you paste box-shadow: 0 10px 20px #00000033, the hex alpha is read as 20 percent opacity and written back as box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);.
Common mistakes
- Using too much opacity. Shadows at 50 percent or more look heavy. Start near 10 to 25 percent and raise it only if the box disappears into the background.
- Forgetting that blur is not size. Blur softens the edge. To make the shadow bigger or smaller, use "Spread".
- Using
emorremor leaving out units. The tool reads lengths inpxonly, and a bare non-zero number such as0 4 12pxis rejected. Write0 4px 12px. - Pasting two colors in one layer. Each layer takes one color. Split the value into two layers.
- Using a negative blur. Blur cannot be negative in CSS, so the paste is rejected.
- Testing only on white. A shadow that looks good on white can vanish on a dark page. Check the dark preview.
Frequently asked questions
What is the difference between box-shadow and drop-shadow?
box-shadow follows the rectangular box of the element, including its border radius. The CSS drop-shadow() filter follows the visible shape, so it works for transparent PNGs and SVGs. For text there is a separate property, shown in the text-shadow generator.
How do I make a shadow only on one side?
Combine a vertical offset with a negative spread. For a bottom-only shadow, use 0 10px 10px -10px and a low-opacity color. The spread pulls the shadow in from the other three sides.
How do I add an inner shadow?
Tick "Inner shadow (inset)" on the layer. You can mix inner and outer layers in the same box-shadow.
Can I paste a shadow from a design tool?
Yes, if it uses px lengths and one color per layer. Any CSS color works: hex, rgb(), hsl() or names. To change the color first, use the color converter.
Does the tool send my CSS to a server?
No. It runs in your browser. If you need a rounded box to put the shadow on, build one with the border-radius generator.