CSS Box-Shadow Generator
Design layered box-shadows visually and copy the CSS.
Stack shadow layers, tune offset, blur, spread, colour and inset on a live preview, then copy one clean box-shadow rule. Free. No sign-up. Runs in your browser, nothing is uploaded.
Preview background
Shadow color
box-shadow: 0px 10px 25px -5px rgba(14, 23, 38, 0.18), 0px 4px 10px -6px rgba(14, 23, 38, 0.12);Drag the sliders and the card in the preview updates as you go; Copy gives you one ready-to-paste line such as box-shadow: 0 10px 25px -5px rgba(14, 23, 38, 0.18), 0 4px 10px -6px rgba(14, 23, 38, 0.12);. That two-layer shadow is also the starting point. Each layer has its own offset X and Y (−100 to 100 px), blur (0–150 px), spread (−50 to 50 px), colour, opacity (0–100%) and an inset switch, and you can add as many layers as you like.
Set the preview background to the surface your component will sit on. A shadow that looks right on white often disappears on light grey and turns muddy on a coloured background.
Reading a box-shadow value left to right
box-shadow: inset 0 10px 25px -5px rgba(14, 23, 38, 0.18);
| Part | Example | What it does |
|---|---|---|
inset (optional) | — | draws inside the box instead of outside |
| Offset X | 0 | positive moves the shadow right, negative left |
| Offset Y | 10px | positive moves it down, which reads as light from above |
| Blur radius | 25px | softness; 0 is a hard edge |
| Spread | -5px | grows (positive) or shrinks (negative) the shape before blurring |
| Colour | rgba(14, 23, 38, 0.18) | almost always a translucent dark tone |
The generator writes the colour as rgba() from your hex colour plus the opacity slider, so 18% opacity on #0e1726 becomes rgba(14, 23, 38, 0.18).
Layer order: the first shadow wins
This catches out a lot of people: in a comma-separated box-shadow, the first shadow is painted on top and every following one goes underneath. In this tool, layer 1 is first in the copied rule, and Add layer appends a new layer at the end, so it lands below the others.
With two translucent dark layers the order barely shows, because the shades simply add up. It matters as soon as one layer is opaque or a different colour, such as a coloured glow plus a dark drop shadow: put the layer that should win at the edges first.
Elevation recipes you can copy
Real elevation is nearly always two layers: a close, tight shadow right under the element and a wider, softer one that fades into the page. The higher an element should float, the bigger and softer the far layer gets. These are the values Tailwind CSS v3 uses for its shadow-md, shadow-lg and shadow-xl utilities, written as two layers with black at 10% opacity:
| Elevation | Layer 1 (X Y blur spread) | Layer 2 (X Y blur spread) | Good for |
|---|---|---|---|
| Medium | 0 4 6 −1 | 0 2 4 −2 | buttons, small cards |
| Large | 0 10 15 −3 | 0 4 6 −4 | cards, dropdowns |
| Extra large | 0 20 25 −5 | 0 8 10 −6 | modals, popovers |
Enter them layer by layer, set colour to #000000 and opacity to 10, and adjust from there. For dark interfaces, shadows barely show; there a lighter surface colour or a 1px border does more to lift an element than a darker shadow.
Inset shadows: recessed, pressed and inner glow
Ticking Inset turns a layer inward, so the element looks carved into the page:
- Input fields: a small inset like
inset 0 1px 2pxat 10–15% opacity makes a field look ready for text. - Pressed buttons: swap the outer shadow for an inset one in the
:activestate. - Inner glow: a light colour at zero offset with a large blur gives a soft glow from the edges inward.
- Glassy lip: combine an outer elevation layer with a faint white inset layer at
0 1px 0for a highlight along the top edge; the Glassmorphism Generator takes that frosted look further.
Shadows that cost performance
Defining a shadow is free; painting it is not. Large blur radii on many elements, or a box-shadow that changes during an animation, make the browser repaint those pixels every frame. For a hover lift on a grid of cards, put the heavier shadow on a pseudo-element and fade its opacity, or animate transform: both can run on the compositor without repainting the shadow. Keep the shadows in long lists as small as the look allows.
And don't let a shadow carry meaning on its own. If it's the only thing separating a card from its background, people on low-contrast screens or in bright light may not see the edge at all; add a border or a background colour difference where it matters. To design the surface the card sits on, pair this with the CSS Gradient Generator.
Frequently asked questions
Related tools
All Color tools →- CSS Gradient GeneratorBuild linear and radial CSS gradients with two colour stops, an angle slider and a live preview — then copy the code.
- Glassmorphism GeneratorCreate frosted-glass cards with live preview and copy-ready CSS.
- Color ConverterConvert any color between HEX, RGB and HSL instantly — pick, preview and copy in one place.
