CSS Box-Shadow Generator

Design layered box-shadows visually and copy the CSS.

Runs in your browserUpdated Built and maintained by Leon and Henrik

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.

CSS Box-Shadow Generator

Preview background

0px
10px
25px
-5px
18%

Shadow color

#0e1726
CSS
box-shadow: 0px 10px 25px -5px rgba(14, 23, 38, 0.18), 0px 4px 10px -6px rgba(14, 23, 38, 0.12);
Runs in your browser
Nothing is uploaded

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);
PartExampleWhat it does
inset (optional)—draws inside the box instead of outside
Offset X0positive moves the shadow right, negative left
Offset Y10pxpositive moves it down, which reads as light from above
Blur radius25pxsoftness; 0 is a hard edge
Spread-5pxgrows (positive) or shrinks (negative) the shape before blurring
Colourrgba(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:

ElevationLayer 1 (X Y blur spread)Layer 2 (X Y blur spread)Good for
Medium0 4 6 −10 2 4 −2buttons, small cards
Large0 10 15 −30 4 6 −4cards, dropdowns
Extra large0 20 25 −50 8 10 −6modals, 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 2px at 10–15% opacity makes a field look ready for text.
  • Pressed buttons: swap the outer shadow for an inset one in the :active state.
  • 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 0 for 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 →