CSS Box-Shadow Generator

Design box shadows visually with a live preview. Adjust offset, blur, spread, and color, stack multiple layers, and copy ready-to-use CSS code.

Preview Background
12px
box-shadow: 0px 4px 12px 0px rgba(15, 23, 42, 0.20);

Build Depth Without Guesswork

Cards, buttons, and modals all lean on box-shadow for depth, but tuning offset, blur, and spread by hand is tedious. Adjust every value visually, stack layers for realistic shadows, and copy clean CSS the moment it looks right.

How this CSS Box-Shadow Generator works

A box-shadow in CSS is built from six values: horizontal offset, vertical offset, blur radius, spread radius, color, and an optional inset keyword. Getting these numbers right by typing them out is slow, especially when you are trying to match a shadow from a design file or reproduce an effect you saw on another site. This generator turns that guesswork into a visual process.

Move the sliders and the preview box updates immediately, so you can see exactly how the shadow behaves before it ever touches your stylesheet. The horizontal and vertical offset sliders push the shadow left, right, up, or down. Blur controls how soft the edge looks, spread grows or shrinks the shadow independent of the shape it comes from, and the color picker sets both the hue and the opacity. Flip the inset switch to turn an outer drop shadow into an inner shadow that reads as a pressed or recessed surface.

Because real interfaces rarely use one shadow, you can stack several layers on top of each other. Layering a tight, dark shadow with a wider, softer one is how most modern card designs and buttons get their depth. The presets at the top give you a fast starting point for soft, hard, long, and neumorphic-style shadows, which you can then fine-tune. Once the effect looks right in the preview, copy the generated CSS and paste it straight into your project.

How to use this CSS Box-Shadow Generator

1

Adjust the shadow

Move the offset, blur, spread, and color controls, or start from a preset, and watch the preview update instantly.

2

Layer or fine-tune

Add another shadow layer for extra depth, toggle inset for a pressed look, and switch the preview background to check contrast.

3

Copy the CSS

Copy the generated box-shadow declaration and paste it directly into your stylesheet or component.

Example Usage

A soft drop shadow commonly used under cards and buttons:

Input
H: 0px, V: 4px, Blur: 12px, Spread: -2px, Color: #0F172A at 25% opacity
Output
box-shadow: 0px 4px 12px -2px rgba(15, 23, 42, 0.25);

Frequently Asked Questions

What is the difference between offset, blur, and spread in a box-shadow?
Offset (X/Y) moves the shadow's position, blur softens its edges by spreading color outward evenly, and spread grows or shrinks the shadow's shape before blur is applied. Adjusting spread without blur gives you a solid, sharply-edged shadow that is larger or smaller than the element itself.
How do I create an inset (inner) shadow instead of a drop shadow?
Turn on the "Inset" toggle for a layer. This adds the inset keyword to the CSS, which flips the shadow so it appears to sit inside the element's border, useful for pressed buttons, input fields, and recessed panels.
Can I use more than one shadow on the same element?
Yes. Browsers support comma-separated box-shadow values, so you can add multiple layers here and this tool combines them into one CSS declaration. Two-layer shadows (a tight dark one plus a soft wide one) are how most modern cards and buttons get realistic depth.
Why does my shadow look blocky or too sharp?
Increase the blur radius. A blur value of 0 produces a hard-edged shadow; raising it spreads the color into a soft gradient. If the shadow still looks harsh, lower the opacity slightly at the same time.
What is a good box-shadow for a neumorphic (soft UI) design?
Neumorphic shadows use two layers: a light shadow offset up-left and a dark shadow offset down-right, both with a large blur and a spread close to zero, on a background close to the shadow colors. Use the "Neumorphic" preset as a starting point and adjust the light/dark balance to match your background color.
Does this tool work with rgba or hex colors?
The color picker outputs hex with a separate opacity value, and the generated CSS combines them into rgba automatically, so the shadow's transparency is included in the code you copy.
Will the generated CSS work in all browsers?
Yes. box-shadow has been fully supported in every modern browser for years, including Chrome, Firefox, Safari, and Edge. No vendor prefixes are needed.
Does this tool store or upload the shadows I create?
No. Every calculation happens locally in your browser using JavaScript. Nothing you design here is sent to a server or saved outside your own device unless you copy and paste it yourself.

Related Tools

The CSS Box-Shadow Generator is maintained by CodeItBro. We aim to provide the best free developer tools on the web. If you have feedback or suggestions, please visit our contact page.

Comments

Questions, corrections, and useful tips are welcome. Comments are reviewed before publication.

Loading comments...

Comments are stored and moderated using Cusdis Cloud. Email is optional. Privacy Policy

As featured on

CodeItBro - Free dev tools + practical guides to help you ship faster | Product HuntCodeItBro - Free Online Developer Tools badgeCodeItBro badge