CSS Box Shadow Generator
Design CSS box shadows visually. Set the offset, blur, spread, color and inset, stack several layers for natural shadows, and copy the box-shadow CSS or Tailwind class.
Create CSS Box Shadows Visually
Good shadows make cards, buttons, menus and modals feel lifted off the page. This box shadow generator lets you shape a shadow with sliders and see it update live on a preview box, so you can find the right depth without guessing numbers.
Stack several layers for soft, realistic shadows, make inner shadows, glows and outlines, and start from presets that use the exact Tailwind CSS shadow values. Copy the box-shadow CSS or a Tailwind class: a built-in class when your shadow matches one, otherwise an arbitrary value.
How to create a box shadow
- Start from a preset or adjust the default shadow.
- Set the offsets, blur and spread with the sliders or by typing numbers. Pick the shadow color and opacity, and tick Inset for an inner shadow.
- Add layers for a softer, more natural result. Select a layer to edit it.
- Check it on your colors by changing the box color, background and border radius, then copy the CSS or the Tailwind class.
box-shadow syntax explained
box-shadow: [inset] offset-x offset-y blur-radius spread-radius color;
| Value | What it does | Example |
|---|---|---|
| offset-x | Moves the shadow right (positive) or left (negative) | 0 |
| offset-y | Moves the shadow down (positive) or up (negative) | 10px |
| blur-radius | How soft the edge is. 0 is a sharp edge | 15px |
| spread-radius | Grows (positive) or shrinks (negative) the shadow | -3px |
| color | Usually a transparent black or a tinted color | rgba(0, 0, 0, 0.1) |
| inset | Draws the shadow inside the element | inset |
Separate several shadows with commas; the first one is drawn on top.
Tailwind CSS shadow values
| Tailwind CSS v3 | Tailwind CSS v4 | box-shadow |
|---|---|---|
shadow-sm | shadow-xs | 0 1px 2px 0 rgb(0 0 0 / 0.05) |
shadow | shadow-sm | 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1) |
shadow-md | shadow-md | 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1) |
shadow-lg | shadow-lg | 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1) |
shadow-xl | shadow-xl | 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1) |
shadow-2xl | shadow-2xl | 0 25px 50px -12px rgb(0 0 0 / 0.25) |
For a custom shadow, use an arbitrary value such as shadow-[0_8px_16px_-4px_rgba(0,0,0,0.15)]. More examples are in the Tailwind shadow docs.
Why layered shadows look more natural
Real shadows are sharp and dark close to an object and softer further away. A single box-shadow cannot do both, but several layers with growing offset and blur can. The "Smooth" preset stacks five layers (1px, 2px, 4px, 8px and 16px) at low opacity, which gives a soft shadow without a muddy edge.
Two more tips: keep the light source consistent (usually from above, so use a positive y offset everywhere), and tint shadows on colored backgrounds with a darker shade of that color instead of pure black.
Inner shadows, glows and outlines
- Inner shadow: add
insetfor pressed buttons and input fields:inset 0 2px 4px rgba(0, 0, 0, 0.12). - Glow: no offset, a large blur and a colored shadow:
0 0 24px 4px rgba(79, 70, 229, 0.55). - Outline without layout shift: only spread, no blur:
0 0 0 2px #4F46E5. Unlike a border, it does not change the element's size, which makes it great for focus rings. - Text shadows use a different property; see the Tailwind text shadow docs.
Frequently Asked Questions
Common questions about CSS box shadows.
Use the box-shadow property, for example box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);. Adjust the shadow above and copy the CSS.
Horizontal offset, vertical offset, blur radius and spread radius, in that order. Only the two offsets are required.
Use several layers with increasing offset and blur at low opacity, like the Smooth preset, and keep the light coming from above.
Tick Inset. It adds the inset keyword, which draws the shadow inside the element.
Copy the Tailwind class from the generator. If your shadow matches a default it shows the built-in class, otherwise an arbitrary value such as shadow-[0_8px_16px_-4px_rgba(0,0,0,0.15)].
No. Shadows are drawn outside the element’s box and do not take up space, so they never move other elements.
Yes. Click Add layer for each extra shadow. In CSS they are separated by commas.