Use this free CSS box shadow generator to add depth to cards, buttons, and panels. Adjust the offset, blur, spread, color, and opacity, check the live preview, and copy the box-shadow rule. Everything is built in your browser, so nothing you choose is sent to our servers.
A subtle shadow can show which elements are clickable and separate content from the background. Keep shadows light for most interfaces and reserve strong ones for pop-ups.
How to use the box shadow generator
- Set the offset: move the shadow horizontally and vertically.
- Set the blur and spread: blur softens the edge, and spread changes the size.
- Choose the color and opacity: a dark color at low opacity usually looks most natural.
- Turn on inset (optional): draw the shadow inside the box.
- Copy: copy the rule and paste it into your stylesheet.
What each value does
| Value | Effect | Example |
|---|---|---|
| Horizontal offset | Moves the shadow left or right | 4px |
| Vertical offset | Moves the shadow up or down | 8px |
| Blur | Softens the shadow edge | 24px |
| Spread | Grows or shrinks the shadow | -4px |
Worked examples
A soft card shadow
Use an offset of 0 horizontally and 8 vertically, a blur of 24, a spread of -4, and a dark color at 25% opacity. The output is box-shadow: 0px 8px 24px -4px rgba(15, 23, 42, 0.25);.
A pressed button
Turn on inset with a small offset of 2 and a blur of 6. The shadow appears inside the edges, which suggests the button is pushed in.
Common mistakes
- Heavy shadows everywhere. Strong shadows on many elements make a page feel busy. Use them only where depth matters.
- Pure black at full opacity. This looks harsh. Lower the opacity or use a tinted dark color.
- Forgetting dark mode. A shadow that looks right on white can disappear on a dark background. Test both.
Frequently asked questions
What is a CSS box shadow?
A box shadow is a visual effect that adds a shadow around an element's box. It is set with the box-shadow property and does not change the element's layout.
What do offset, blur, and spread mean?
The horizontal and vertical offsets move the shadow left or right and up or down. Blur softens the edge, and spread makes the shadow larger or smaller than the box.
What does the inset option do?
Inset draws the shadow inside the box instead of outside it, which can make an element look pressed in.
Does box-shadow work in all browsers?
Modern browsers support box-shadow with the syntax this tool outputs. Very old browsers may ignore it, and the page still works without the shadow.
Is the Xornex CSS box shadow generator free?
Yes. The Xornex CSS box shadow generator is available to use free of charge.