No shadow layers. Click Add layer or pick a preset.
Layer 1
px
px
px
px
Hex color like #000000. Eight digits also set the opacity.
%
1 layer · works in every browser, no prefix needed
Presets One click to load, then fine-tune
CSS Box Shadow Generator – Free Online Tool
What is box-shadow?
box-shadow is the CSS property that puts a shadow around an element. It’s what makes a card look
like it floats above the page, a button look pressed, or an input glow when you click into it. You tell it where
the shadow goes, how blurry it is, how big it is and what color it has, and the browser draws it around the box,
rounded corners included.
Writing those numbers by hand is mostly guesswork, which is why this generator exists. Drag a slider, see the
shadow change on a real box, and copy the finished CSS. Here’s the same white card with four different shadows:
No shadow
Subtle
Soft
Floating
How to Use It – Step by Step
Five quick steps. Everything happens in your browser, and your last shadow is remembered for next time.
Step 1 Start From a Preset
Click any tile under Presets: Soft, Card, Floating, Material, Neumorphism, Neon glow and more.
It’s much faster to tweak a good shadow than to build one from zero. Already have a shadow in your stylesheet?
Click Paste CSS, paste it (with or without box-shadow:) and press Load.
Step 2 Move and Soften the Shadow
Use the sliders, or type an exact number in the box next to each one. The preview and the CSS update as you go.
Horizontal / Vertical offset: where the shadow sits. Small vertical values look the most natural.
Blur: how soft the edge is. 0 gives a hard, “retro” shadow.
Spread: makes the shadow bigger (positive) or smaller (negative) than the box.
Inset: flip it on to draw the shadow inside the box.
Step 3 Pick the Color and Opacity
Choose a color with the picker or type a hex code, then lower the Opacity. Real shadows are
faint: 10–25% black looks right on a white page. Fully opaque colors are great for hard shadows and rings.
The CSS uses rgba() when the color is see-through, and plain hex when it isn’t.
Step 4 Stack Layers for Depth
Click Add layer to add another shadow (it starts as a softer, bigger copy of the selected
one). Click a layer to edit it, use ↑ and ↓ to change the order, and
✕ to delete it. The first layer in the list is drawn on top. Two or three layers usually look
much more real than one.
Step 5 Check It on Light and Dark, Then Copy
Under the preview, switch the Background (white, gray, blue-gray, dark or any color), change
the box color, its corner radius and its size. A shadow that looks great on white can vanish on a dark page,
so it’s worth a quick check. When you’re happy, press Copy. Pick Tailwind if
you want a ready-made class like shadow-[0_4px_12px_rgba(0,0,0,0.1)] instead of plain CSS.
💡 Want a shadow on text instead? Switch to Text shadow at the top. It has its own layers and
presets (retro, 3D, neon, outline), and you can click the preview text to type your own words.
The box-shadow Syntax, Value by Value
One shadow is up to four lengths, a color and an optional inset, in this order:
box-shadow: [inset]offset-x offset-y[blur][spread]color;
/* for example */box-shadow: 0 4px 12px -2pxrgba(0, 0, 0, 0.2);
The two offsets are required. Blur and spread are optional and default to 0, and the color defaults
to the text color. Lengths need a unit (px, rem…) unless they’re zero. Here’s what each
value does, on a white box:
1. Horizontal offset
box-shadow: 10px 0 0 #0b0f19;
The first number moves the shadow sideways. Positive goes right, negative goes left. Zero keeps it centered.
2. Vertical offset
box-shadow: 0 10px 0 #0b0f19;
The second number moves it down (positive) or up (negative). Most real shadows fall down a little.
3. Blur radius
box-shadow: 0 10px 20px #0b0f19;
How soft the edge is. 0 is a sharp copy of the box; bigger numbers fade it out. It can’t be negative.
4. Spread (positive)
box-shadow: 0 0 0 8px #84cc16;
Grows the shadow on every side before blurring. With no blur and no offset it draws a solid ring, like an outline that follows the corners.
4. Spread (negative)
box-shadow: 0 16px 16px -10px #0b0f19;
Shrinks the shadow, so it only peeks out where the offset pushes it. This is the trick for a shadow under the bottom edge only.
5. Color
box-shadow: 0 10px 24px rgba(79, 70, 229, 0.5);
Any CSS color works. Use rgba() (or 8-digit hex) to make it see-through: the last number is the opacity, from 0 to 1.
inset
box-shadow: inset 0 4px 12px rgba(0, 0, 0, 0.35);
Adding the word inset (first or last) moves the shadow inside the box, so it looks pressed in.
Separate shadows with commas. The first one in the list is drawn on top, so here the white ring sits above the dark one.
💡 box-shadow: none; removes every shadow, which is handy to switch off a shadow from a framework or on
hover. And because a shadow takes up no space, adding one never moves anything else on the page.
What About text-shadow?
text-shadow works the same way but follows the letters instead of the box. It takes the offsets,
the blur and the color, and that’s it: there’s no spread and no inset. You can still stack layers
with commas, which is how outline, 3D and neon text effects are made.
Soft3DNeon
Tips for Good-Looking Shadows
Keep it soft
The most common mistake is a shadow that’s too dark and too even, like 0 0 20px #000. Real light
comes from above, so use a small vertical offset, a big blur and a low opacity (5–25%).
Harsh
Soft, layered
Layer two or three shadows
A tight, slightly darker shadow close to the box plus a large, faint one further away looks like real depth.
Doubling the offset and blur for each layer (1, 2, 4, 8, 16px) gives a very smooth result: try the
Smooth layered preset.
Tint your shadows
On a colored background, a gray shadow looks dirty. Use a darker, see-through version of the background or the
element’s own color instead, like the Colored preset. It feels much more natural.
Dark mode needs a different trick
Black shadows barely show on a dark page. Use a lighter surface color for raised elements, a thin light border,
or a subtle glow, and check it with the dark background in the preview.
Watch performance
Shadows are cheap when they sit still, but animating box-shadow (for example on hover) makes the
browser repaint every frame, and huge blur values on long lists cost more. For smooth hover effects, put the
bigger shadow on a ::after pseudo-element and animate its opacity instead.
No prefixes needed
-webkit-box-shadow and -moz-box-shadow were needed around 2010. Every current
browser understands plain box-shadow, so this generator leaves the prefixes out.
It draws one or more shadows around an element’s box. You set how far the shadow moves sideways and down, how blurry it is, how much it grows (spread), its color, and whether it falls outside the box or inside it (inset). The shadow follows the element’s border-radius and doesn’t take up any space, so it never pushes other elements around.
What do the numbers in box-shadow mean?
In box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.2) the values are, in order: horizontal offset (0, positive moves right), vertical offset (4px, positive moves down), blur radius (12px, bigger is softer, never negative), spread (-2px, positive grows the shadow, negative shrinks it), then the color. Blur and spread are optional and default to 0. Add the word inset to put the shadow inside the box.
How do I make a soft, realistic shadow?
Use a low-opacity color (5–25%), a vertical offset bigger than the horizontal one (light usually comes from above), a generous blur and a small negative spread so the shadow peeks out mainly at the bottom. For extra realism, stack two or three layers: a tight, darker one close to the box and a big, faint one further away. The Soft, Floating and Smooth layered presets in the generator are good starting points.
How do I add more than one shadow to an element?
Separate the shadows with commas in one box-shadow declaration, for example box-shadow: 0 1px 2px rgba(0,0,0,.1), 0 8px 24px rgba(0,0,0,.1). The first shadow in the list is drawn on top. In the generator, click Add layer, then pick a layer to edit it and use the arrows to change the order.
What is an inset shadow?
With the inset keyword the shadow is drawn inside the element’s border instead of outside, so the box looks pressed in or hollow. It’s great for input fields, pressed buttons and the “pressed” neumorphism look. Inset and normal shadows can be mixed in the same list.
Do I still need -webkit-box-shadow?
No. Every browser in use today supports the plain box-shadow property, and has done so for over a decade (Chrome 10, Firefox 4, Safari 5.1, IE 9). The -webkit- and -moz- versions only mattered for browsers from around 2010, so the generator leaves them out to keep your CSS short.
What’s the difference between box-shadow and filter: drop-shadow()?
box-shadow always follows the element’s rectangle (with its rounded corners). filter: drop-shadow() follows the actual visible shape, so it hugs the transparent edges of a PNG, an SVG icon or a speech-bubble arrow. drop-shadow() has no spread and no inset, and it takes only one shadow per function. For normal boxes, cards and buttons, box-shadow is the right choice.
Why is my box-shadow not showing?
The usual reasons: a parent has overflow: hidden and clips the shadow; the next element sits on top of it (add a margin or position: relative with z-index); the shadow color is almost the same as the background; or there’s a typo, such as a missing comma between layers or a missing px, which makes the browser ignore the whole declaration. Paste the value into the generator’s Paste CSS box to check it.