CSS Box Shadow Generator

Build a box-shadow with sliders and copy the CSS. Offset, blur, spread, colour and opacity, plus inset for shadows that fall inside the box. Add as many layers as you like — and know that the first layer in the list paints on top of the ones below it, the reverse of a design tool's layer panel, which is the thing that trips people up. The presets are layered rather than single, because that is how convincing shadows are actually built: one tight shadow for the contact edge and a looser one for the ambient spread reads as a light source, where one large blur reads as a grey smear. The neumorphic preset shows the trick of pairing a dark shadow with a light one on the opposite side.

Reading a box-shadow

PartEffect
Offset X / YMoves the shadow — implies light direction
BlurSoftens the edge; 0 is a hard shadow
SpreadGrows or shrinks before blurring; negative pulls it in
Colour with alphaAlmost always partly transparent black
insetDraws inside the box instead of outside

When to use it

  1. Add depth to a card, button or modal.
  2. Build a layered shadow that looks like real light.
  3. Create an inset shadow for a pressed or inlaid effect.
  4. Match a shadow from a design mockup.
  5. Produce a neumorphic soft-UI effect.

How to Use

  1. Drag the sliders, or start from a preset.
  2. Add layers for a more realistic shadow.
  3. Copy the generated CSS.

Features

  1. Unlimited layers with add and remove
  2. Offset, blur, spread and opacity sliders
  3. Inset shadows
  4. Layered presets including neumorphism
  5. Adjustable element colour in the preview
  6. Output written as hand-written CSS would be

FAQs

What does each value mean?

In order: horizontal offset, vertical offset, blur radius, spread radius, then the colour. Offsets move the shadow, blur softens its edge, and spread grows or shrinks it before blurring — a negative spread is how you pull a shadow in so only the blur shows.

Which layer appears on top?

The first one. Box-shadow paints its layers front to back, so the first in the comma-separated list covers the ones after it. This is the opposite of a design tool's layer list, and it is a common source of confusion when a shadow refuses to show.

Why do the presets use several layers?

Because real shadows are not one blur. A tight, dark shadow near the element gives the contact edge, and a wider, fainter one gives ambient spread. Together they read as a light source; a single large blur reads as a flat grey patch. Every mature design system does this.

What does inset do?

Draws the shadow inside the element instead of outside, which makes the box look recessed rather than raised. Useful for pressed buttons, input fields and inlaid panels.

Do shadows hurt performance?

A static one, no. Animating blur or spread does, because the browser has to repaint the shadow every frame. If you need a shadow to change on hover, animating opacity on a second element with a pre-rendered shadow is far cheaper.

Why is my spread not in the output?

Because it is zero, and a zero spread changes nothing. It is omitted so the copied CSS looks like what you would write by hand. Set any non-zero value and it appears.

Technical Details

Multiple shadow layers are comma separated, and the paint order is the detail worth knowing: the first layer in the list renders on top of the ones after it, which is the reverse of how a layer panel in a design tool behaves and catches people out constantly. The interface says so rather than leaving it to be discovered. A zero spread is omitted from the output because the property is positional — omitting a trailing zero changes nothing, and hand-written CSS does not carry it. Zero offsets are written bare rather than as 0px for the same reason. Colours are held as rgba so opacity is a first-class control; the colour input itself only speaks hex, so the value is decomposed and reassembled around the alpha rather than losing it on every edit, which is the usual bug in a generator that mixes a hex picker with an alpha slider. The layered presets are built the way real design systems build them — two or three shadows with different blurs and negative spreads, because a single large blur reads as a flat grey smear while stacked shadows with tight and loose layers produce the impression of a light source. The neumorphic preset pairs a dark shadow with a light one on the opposite side, which is the entire trick behind that style.

Web & CSS Tools

Web & CSS Tools

  • Cubic Bezier Generator
  • CSS Clip Path Generator
  • CSS Keyframes Generator
  • CSS Unit Converter
  • Layout Grid Calculator
  • Design Tokens Converter
  • SVG Sprite Builder
  • Font Subsetter and WOFF2 Converter