🌑 CSS Box Shadow Generator
By ToolNimba Editorial Team · Updated 2026-06-19
Drag the sliders or pick a color. The preview and CSS update live.
This CSS box shadow generator lets you build a box-shadow value visually instead of guessing numbers by hand. Drag the sliders for horizontal and vertical offset, blur, and spread, pick a shadow color, set its opacity, and flip the inset toggle for an inner shadow. A live preview shows exactly how the shadow looks, and one click copies the ready-to-paste CSS. Everything runs in your browser, so nothing you build is ever sent to a server.
What is the CSS Box Shadow Generator?
The CSS box-shadow property draws a shadow around an element’s box. A single shadow is written as five parts in this order: horizontal offset, vertical offset, blur radius, spread radius, and color, optionally preceded by the inset keyword. For example, box-shadow: 10px 10px 20px 0px rgba(30, 41, 59, 0.4) pushes the shadow 10px right and 10px down, softens it with 20px of blur, leaves the spread at 0, and uses a dark slate color at 40% opacity.
Each value does a distinct job. The horizontal and vertical offsets move the shadow relative to the element; positive values go right and down, negative values go left and up. The blur radius controls how soft the edge is, with 0 giving a hard edge and larger numbers giving a soft, diffuse glow. The spread radius grows (positive) or shrinks (negative) the shadow before the blur is applied. The color, usually written as rgba() or hsla() so you can control opacity, sets the tone; semi-transparent dark colors read as natural shadows, while bright colors read as glows.
The inset keyword flips the shadow inward, painting it inside the element’s border rather than outside. Outer shadows make a card or button appear to float above the page, while inset shadows make an element look recessed, like a pressed key or an input well. You can stack several shadows on one element by separating them with commas, which is how designers build layered, realistic depth. This generator focuses on a single, clean shadow you can then duplicate and tweak as needed.
When to use it
- Designing a subtle drop shadow for cards, buttons, or modals without trial-and-error in dev tools.
- Creating an inset shadow to make inputs or pressed buttons look recessed.
- Prototyping a soft glow effect by using a bright color with high blur and zero offset.
- Teaching or learning how each box-shadow value (offset, blur, spread) changes the result.
How to use the CSS Box Shadow Generator
- Drag the horizontal and vertical offset sliders to position the shadow.
- Adjust the blur slider to soften the edge and the spread slider to grow or shrink it.
- Pick a shadow color and set its opacity with the opacity slider.
- Toggle Inset if you want an inner shadow instead of an outer one.
- Watch the live preview, then click Copy to grab the box-shadow CSS.
Formula & method
Worked examples
A soft floating card shadow: 10px right, 10px down, 20px blur, no spread, dark slate at 40% opacity.
- Color #1e293b converts to rgb(30, 41, 59).
- Opacity 40% becomes an alpha of 0.4.
- Combine the values in order: 10px 10px 20px 0px rgba(30, 41, 59, 0.4).
Result: box-shadow: 10px 10px 20px 0px rgba(30, 41, 59, 0.4);
A pressed inset shadow: no offset, 8px blur, 2px spread, black at 30% opacity.
- Color #000000 converts to rgb(0, 0, 0).
- Opacity 30% becomes an alpha of 0.3.
- Add the inset keyword first, then the values: inset 0px 0px 8px 2px rgba(0, 0, 0, 0.3).
Result: box-shadow: inset 0px 0px 8px 2px rgba(0, 0, 0, 0.3);
What each box-shadow value controls
| Value | Effect | Notes |
|---|---|---|
| Horizontal offset | Moves the shadow left or right | Positive moves right, negative moves left |
| Vertical offset | Moves the shadow up or down | Positive moves down, negative moves up |
| Blur radius | Softens the shadow edge | Must be 0 or positive; larger is softer |
| Spread radius | Grows or shrinks the shadow | Positive expands, negative contracts |
| Color | Sets the shadow tone and opacity | Use rgba() or hsla() for transparency |
| inset | Draws the shadow inside the element | Omit it for a normal outer shadow |
Common mistakes to avoid
- Writing a negative blur radius. The blur radius cannot be negative. CSS treats a negative value as invalid and ignores the whole shadow, so keep blur at 0 or higher and use spread for shrinking.
- Getting the value order wrong. The order is offset-x, offset-y, blur, spread, color. Swapping offset and blur, or putting the color first, produces a different shadow or breaks the rule entirely.
- Using a fully opaque color. A solid color like #000 often looks harsh and flat. Real shadows are semi-transparent, so use rgba() with an alpha around 0.1 to 0.4 for a natural look.
- Expecting inset to push the box outward. The inset keyword paints the shadow inside the element. If you want the box to appear lifted off the page, remove inset and use an outer shadow instead.
Glossary
- box-shadow
- The CSS property that draws one or more shadows around an element’s box.
- Offset
- How far the shadow is shifted from the element, given as a horizontal and a vertical distance.
- Blur radius
- How far the shadow edge is softened. A value of 0 gives a sharp edge; larger values diffuse it.
- Spread radius
- A value that expands (positive) or contracts (negative) the shadow size before blur is applied.
- Inset
- A keyword that makes the shadow appear inside the element, giving a recessed or pressed look.
- rgba()
- A color notation taking red, green, blue, and an alpha (opacity) channel from 0 to 1.
Frequently asked questions
What is a CSS box shadow generator?
It is a visual tool that builds the CSS box-shadow value for you. You adjust offset, blur, spread, color, and opacity with controls, see a live preview, and copy the resulting code instead of writing it by hand.
How does the CSS box-shadow property work?
box-shadow takes five parts in order: horizontal offset, vertical offset, blur radius, spread radius, and color, optionally led by the inset keyword. Together they position, size, soften, and color the shadow.
What does the inset keyword do?
Inset draws the shadow inside the element rather than outside, so the box looks recessed or pressed in. Without inset, the shadow sits outside and the element appears to float above the page.
What is the difference between blur and spread?
Blur softens the shadow edge so it fades out gradually, while spread changes the shadow size before blur is applied. Positive spread makes the shadow larger; negative spread makes it smaller.
Can I add more than one shadow to an element?
Yes. List multiple shadows separated by commas in a single box-shadow rule. Designers layer several shadows to create more realistic, multi-step depth. This tool generates one clean shadow you can duplicate and adjust.
Is this box shadow generator free and private?
Yes. The tool is completely free and runs entirely in your browser. Nothing you create is uploaded or sent to a server, so your design stays on your own device.