CSS Box Shadow Generator
Design CSS box-shadow effects visually, including multi-layer and inset shadows, and copy the generated code instantly. Add depth to a card component, simulate a focus ring, or match a shadow spec from a design handoff, all in your browser.
box-shadow: 0px 4px 6px 0px rgba(0, 0, 0, 0.25);Usage examples
Adding depth to a card component
Use a soft, low-opacity shadow with a small offset and generous blur to lift a card off the page without looking harsh.
Creating a layered, realistic shadow
Add two or three layers — a tight, darker shadow close to the element plus a larger, softer one further out — the way design tools like Figma build 'elevation' shadows.
Building an inward pressed/inset effect
Enable 'Inset' on a layer to make the shadow appear inside the element's border instead of outside, useful for input fields or a pressed-button look.
Simulating a focus ring or outline glow
Set offset X and Y to 0, add a wide spread with no blur, and pick a bright, semi-transparent color to create a solid-edged glow effect around buttons or form fields.
Matching a shadow spec handed off from a designer
If a design file lists a shadow as '0px 4px 12px rgba(0,0,0,0.15)', set offset Y to 4, blur to 12, and dial the color/opacity sliders to reproduce the rgba value exactly, then copy the resulting CSS.
Quick reference
box-shadow examples
| Example | Offset X | Offset Y | Blur | Spread | Inset | CSS |
|---|---|---|---|---|---|---|
| Default | 0px | 4px | 6px | 0px | box-shadow: 0px 4px 6px 0px rgba(0, 0, 0, 0.25); | |
| Subtle | 0px | 1px | 2px | 0px | box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05); | |
| Soft drop | 0px | 4px | 6px | -1px | box-shadow: 0px 4px 6px -1px rgba(0, 0, 0, 0.1); | |
| Large floating | 0px | 20px | 25px | -5px | box-shadow: 0px 20px 25px -5px rgba(0, 0, 0, 0.1); | |
| Hard offset (no blur) | 4px | 4px | 0px | 0px | box-shadow: 4px 4px 0px 0px rgba(0, 0, 0, 1); | |
| Upward shadow | 0px | -4px | 6px | 0px | box-shadow: 0px -4px 6px 0px rgba(0, 0, 0, 0.25); | |
| Glow | 0px | 0px | 12px | 0px | box-shadow: 0px 0px 12px 0px rgba(59, 130, 246, 0.6); | |
| Outline ring (spread only) | 0px | 0px | 0px | 3px | box-shadow: 0px 0px 0px 3px rgba(59, 130, 246, 0.5); | |
| Inset | 0px | 2px | 4px | 0px | ✓ | box-shadow: inset 0px 2px 4px 0px rgba(0, 0, 0, 0.06); |
| Inset pressed | 0px | 0px | 8px | 0px | ✓ | box-shadow: inset 0px 0px 8px 0px rgba(0, 0, 0, 0.3); |
Shadow layers
| Example | CSS |
|---|---|
| Two-layer depth | box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.1), 0px 1px 2px -1px rgba(0, 0, 0, 0.1); |
| Ring + drop | box-shadow: 0px 0px 0px 2px rgba(59, 130, 246, 1), 0px 4px 6px -1px rgba(0, 0, 0, 0.1); |
Color + Opacity → rgba()
| Color | Opacity | rgba() |
|---|---|---|
| #000000 | 5% | rgba(0, 0, 0, 0.05) |
| #000000 | 10% | rgba(0, 0, 0, 0.1) |
| #000000 | 25% | rgba(0, 0, 0, 0.25) |
| #000000 | 50% | rgba(0, 0, 0, 0.5) |
| #000000 | 100% | rgba(0, 0, 0, 1) |
| #000 | 25% | rgba(0, 0, 0, 0.25) |
| #ffffff | 50% | rgba(255, 255, 255, 0.5) |
| #3b82f6 | 60% | rgba(59, 130, 246, 0.6) |
Frequently asked questions
What do offset, blur, and spread actually control?
Offset X/Y move the shadow horizontally/vertically relative to the element. Blur controls how soft/fuzzy the edge is — '0' gives a sharp edge. Spread grows or shrinks the shadow's size in every direction before blurring is applied.
Why is there an opacity slider instead of just a color picker?
A plain hex color like '#000000' has no transparency, but real-world shadows are almost always semi-transparent. The opacity slider lets you dial in how see-through the shadow is, and the tool converts your color + opacity into an 'rgba()' value automatically.
Can I stack multiple shadows on one element?
Yes. CSS 'box-shadow' accepts a comma-separated list of shadows, and this tool's 'Add layer' button lets you build that list visually — the generated code places one shadow per line for readability.
What does the 'inset' checkbox do?
By default a shadow is cast outward, as if the element is raised above the page. Checking 'Inset' flips it so the shadow appears to be cast inward, as if the element were pressed into the page.
Is the generated CSS supported in all browsers?
Yes. 'box-shadow' (including multiple comma-separated shadows and the 'inset' keyword) is standard CSS supported by all major modern browsers without vendor prefixes.
What happens if I set spread to a negative value?
A negative spread shrinks the shadow's bounding box before blur is applied, instead of growing it. This is a common trick for keeping a soft shadow from peeking out past the sides of an element — pair a negative spread with a larger offset Y to create a shadow that only shows below the element.
What's the difference between 'blur' and 'spread'?
Blur softens the shadow's edge by spreading its color outward in a fade, similar to a Gaussian blur — higher values make the shadow fuzzier and larger-looking. Spread expands or contracts the sharp-edged shadow shape itself before any blur is applied, independent of softness. A shadow can have high spread and zero blur, producing a sharp-edged halo.