CSS Box Shadow Generator
Create soft, layered, colored or inner shadows with a live preview, then copy clean CSS code. Free and runs in your browser.
Shadow layers
How to Use the Box Shadow Generator
- Adjust the horizontal and vertical offset to move the shadow.
- Increase blur for a softer edge and use spread to grow or shrink the shadow.
- Pick a shadow color and set its opacity.
- Tick Inset for an inner shadow.
- Click + Add layer to stack up to five shadows, or start from a preset.
- Click Copy CSS and paste the code into your stylesheet.
Understanding the box-shadow Syntax
A CSS box shadow is written like this:
| Value | What it does |
|---|---|
inset | Optional. Draws the shadow inside the element. |
| offset-x | Moves the shadow right (positive) or left (negative). |
| offset-y | Moves the shadow down (positive) or up (negative). |
| blur-radius | Softens the edge. 0 gives a hard edge; it cannot be negative. |
| spread-radius | Expands (positive) or contracts (negative) the shadow before blurring. |
| color | Any CSS color. Using rgba() lets you control transparency. |
You can apply several shadows to one element by separating them with commas. The first shadow listed is drawn on top.
Practical Examples
- Soft card:
box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08); - Lifted on hover:
box-shadow: 0 20px 40px -12px rgba(15, 23, 42, 0.3); - Retro / neo-brutalist:
box-shadow: 6px 6px 0 #111827; - Colored glow:
box-shadow: 0 0 40px 4px rgba(108, 92, 231, 0.55); - Pressed input:
box-shadow: inset 0 2px 8px rgba(15, 23, 42, 0.18);
Tips for Natural-Looking Shadows
- Keep opacity low. Real shadows are subtle; values around 5–20% usually look best on light backgrounds.
- Tint your shadows. A dark navy or the background’s own hue often looks more natural than pure black.
- Layer small and large shadows. A tight, sharp shadow plus a wide, soft one mimics real light — try the “Layered” preset.
- Use negative spread for lift. It keeps a large blurred shadow from spreading too far to the sides.
- Stay consistent. Use the same light direction (usually from above) across your whole interface.
- Don’t rely on shadows alone. Shadows can be hard to see in dark mode or for some users. A subtle border helps cards stay visible.
Shadows in Dark Mode
Dark shadows barely show on dark backgrounds. In dark themes, designers often use lighter surface colors to show elevation, add a faint border such as 1px solid rgba(255, 255, 255, 0.08), or use a soft colored glow for highlighted elements.
Performance Note
Box shadows are well supported in all modern browsers. Very large blur values on many elements, or animating box-shadow directly, can be heavier to render. For hover animations, a common technique is to animate the opacity of a pseudo-element that holds the shadow.
Related Learning Guides
Frequently Asked Questions
What is box-shadow in CSS?
A CSS property that adds one or more shadows around (or inside) an element. It is commonly used for cards, buttons, dropdowns and modals.
What is the difference between blur and spread?
Blur controls how soft the shadow edge is. Spread makes the shadow larger or smaller before it is blurred.
How do I add multiple shadows?
Separate each shadow with a comma in the same box-shadow declaration. In this tool, click + Add layer.
How do I make an inner shadow?
Add the inset keyword at the start of the shadow, or tick Inset in the generator.
Does box-shadow work on all browsers?
Yes. box-shadow is supported in all modern browsers without vendor prefixes.