Design ToolsA little help for every day

Search by name or task, such as JSON or percentage.

Design Tools

CSS Box Shadow Generator

Create CSS box-shadow code with a live preview: set the X and Y offset, blur, spread, colour, opacity and inset, then copy a declaration with an rgba() colour.

View all tools
ResultUpdates as you type
box-shadow: 0 12px 24px rgba(15, 23, 42, 0.18);

How to use CSS Box Shadow Generator

Adjust the X and Y offsets and the blur and spread radii, then pick the shadow colour and opacity. Tick Inner shadow for an inset effect and change the preview card colour to test it on your design. Copy the code below.

  1. Set offset and blurPositive X moves the shadow right and positive Y moves it down; a blur of 0 gives a hard edge.
  2. Choose colour and opacityPick the shadow colour and set opacity from 0 to 100%; the code uses an rgba() value.
  3. Preview and copyToggle inset, try another card colour in the preview, then copy the box-shadow declaration.

The order of box-shadow values

A shadow is written as an optional inset keyword, then the X offset, the Y offset, the blur radius, the spread radius and the colour. With Y at 4px, blur 12px, spread 2px and inset ticked you get box-shadow: inset 0 4px 12px 2px rgba(15, 23, 42, 0.18);. A spread of 0 is left out, and zero values are written as a plain 0 without a unit. Blur can't be negative, while offsets and spread can, and every value is limited to ±1000px.

Shadows that look natural

The default, 0 12px 24px at 18% opacity in a very dark blue-grey, is a typical raised-card shadow: a larger Y offset and blur with low opacity reads as soft light from above. A translucent dark colour usually looks better than pure black, especially on tinted backgrounds. For a pressed button try an inset shadow, and for a flat, hard-edged shadow set blur to 0, as in 0 2px 0. A negative spread shrinks the shadow, which helps keep it tucked under the element on one side only.

Accuracy and data handling

Review colours, dimensions and visual settings in the real component, type size and target display. The calculation runs in your current browser; the tool code does not send the input to a processing API.

FAQ

What do the box-shadow numbers mean?

In order: horizontal offset, vertical offset, blur radius and spread radius, followed by the colour. Adding inset at the start draws the shadow inside the element instead of outside.

How do I change the shadow colour and transparency?

Choose a colour with the Shadow colour picker and set Opacity between 0 and 100. The output combines them into an rgba() value, such as rgba(15, 23, 42, 0.18) for 18%.

What happens if I set blur to 0?

The shadow gets a crisp, hard edge and the third number in the code is 0. Blur can't be negative; entering a negative value shows an error instead.

More Design Tools

Related tools