CSS Shadow Generator

Build layered box-shadow and text-shadow rules with sliders and presets, preview them on your own colours and copy the CSS.

Presets:

Layers (2/8)

The first layer is painted on top of the others.

0px
4px
6px
-1px
10%
CSS
box-shadow: 0px 4px 6px -1px rgba(0, 0, 0, 0.1),
    0px 2px 4px -2px rgba(0, 0, 0, 0.1);

What the generator does

Shadows give interfaces depth: they separate a card from the page, show that a button can be pressed and draw a focus ring around an input. Writing box-shadow by hand is tedious because the values interact (offset, blur and spread together decide how soft the shadow looks) and good shadows usually need more than one layer. This tool lets you build the shadow visually, layer by layer, and copy a clean CSS declaration.

How to use it

  1. Choose box-shadow for elements or text-shadow for text.
  2. Start from a Preset such as Card, Elevated or Glow, or keep the default.
  3. Select a layer in Layers and adjust Offset X, Offset Y, Blur, Spread, Opacity and Colour. Tick Inset to draw it inside the box.
  4. Use + Add layer to stack another shadow (up to eight), the arrows to reorder, and ✕ to delete.
  5. Change Background and Box colour (or Text colour) to see the result on your real palette, then click Copy CSS.

Worked example

The Elevated preset produces three layers: a tight contact shadow, a medium one and a large, soft ambient shadow pulled in with negative spread.

box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06),
    0px 8px 16px 0px rgba(0, 0, 0, 0.08),
    0px 24px 48px -8px rgba(0, 0, 0, 0.18);

Each layer is faint on its own; together they read as a card floating above the page. Swap the colour of all layers for a tinted shadow (for example a dark blue on a blue background) and it will look less muddy than pure black.

What each setting means

  • Offset X / Y: moves the shadow right/down (positive) or left/up (negative). A consistent Y offset across a design implies a single light source above.
  • Blur: radius of the blur; 0 gives a hard edge (the "Hard offset" preset).
  • Spread: enlarges or shrinks the shadow before blurring. With 0 offset and 0 blur it draws a solid ring, which is how the "Focus ring" preset works.
  • Opacity: written as rgba() in the output; at 100% the plain hex colour is used.
  • Inset: draws the shadow inside the padding box, for input fields and pressed states.

Limitations

Values are whole pixels within the slider ranges (offsets ±60 px, blur up to 100 px). Shadows follow the element's rectangle and border-radius, not transparent areas of an image: for a PNG with transparency use filter: drop-shadow() instead, which this tool does not generate. Text shadows do not support spread, so thick outlines are approximated with several 1 px layers.

Tips

  • Keep opacity low (5–20%) for everyday UI shadows; strong shadows look dated quickly.
  • Use shadows for focus rings instead of outline only if you keep enough contrast; check it with the contrast checker.
  • Pair shadows with backgrounds from the CSS gradient generator to test them on real surfaces.

Frequently Asked Questions

What is the difference between box-shadow and text-shadow?

box-shadow is drawn around (or inside) the element's border box, following its border-radius. text-shadow is drawn behind the glyphs of the text and has no spread or inset option.

Why use several shadow layers?

Real shadows have a sharp, dark part close to the object and a soft, faint part further away. Stacking two or three layers with different offsets and blur values imitates that and looks more natural than one large blurred shadow.

In which order are multiple shadows drawn?

The first shadow in the comma-separated list is painted on top and the last one at the bottom. Use the up and down arrows in the layer list to change the order.

What do spread and inset do?

Spread grows (positive) or shrinks (negative) the shadow before it is blurred; a shadow with 0 offset, 0 blur and a positive spread works like an outline that does not affect layout. Inset draws the shadow inside the box, which looks like a pressed or recessed surface.

Does box-shadow affect layout or performance?

It never changes layout or the element's size. Large blur radii and animating box-shadow can be expensive to repaint, so for hover effects it is cheaper to animate the opacity of a pseudo-element that carries the shadow.

Is my design sent anywhere?

No. The tool only builds a CSS string in your browser; nothing is uploaded or stored.