Skip to content

CSS Box Shadow Generator

Build CSS box shadows with sliders for offset, blur, spread, color and opacity. Stack up to 6 layers, preview live, copy as CSS or Tailwind.

Presets
Shadow layers (1 of 6)
Layer 1

A shadow needs at least 1 layer, so this one cannot be removed.

CSS
box-shadow: 0px 4px 16px 0px rgba(0, 0, 0, 0.08);
Tailwind
shadow-[0px_4px_16px_0px_rgba(0,0,0,0.08)]

01 · Definition

What is box-shadow in CSS?

box-shadow is the CSS property that draws one or more shadows around an element's box. Each shadow has a horizontal offset, a vertical offset, a blur radius, a spread radius and a color, plus an optional inset keyword that draws it inside the box. Several shadows are separated by commas and painted front to back.

02 · Overview

How the CSS Box Shadow Generator works

Compose box shadows visually. Stack up to 6 layers and set offset, blur, spread, color, opacity and inset for each one while the preview updates. Six presets (Subtle, Card, Hover, Pop, Inset, Focus ring) give a starting point. Copy the result as a CSS box-shadow declaration or as a Tailwind arbitrary-value class. Everything runs in your browser.

03 · Guide

box-shadow syntax: what each value means

A shadow is written as up to four lengths and a color, in a fixed order: offset-x, offset-y, blur-radius, spread-radius, color. The tool always writes all four lengths, as in box-shadow: 0px 4px 16px 0px rgba(0, 0, 0, 0.08). The inset keyword in front turns it into an inner shadow, and commas separate layers.

The meanings in the table follow MDN's box-shadow reference; the ranges are those of this tool's sliders.

ValueEffectRange in this tool
offset-xMoves the shadow right; negative values move it left-40px to 40px
offset-yMoves the shadow down; negative values move it up-40px to 40px
blur-radiusBigger and lighter as it grows; 0 is a sharp edge; never negative0 to 80px
spread-radiusPositive values grow the shadow, negative values shrink it-40px to 40px
colorWritten as rgba() from the hex color and the opacity0 to 100% opacity
insetDraws the shadow inside the boxOn or off per layer
The parts of a box-shadow value

04 · Use cases

When to use the CSS Box Shadow Generator

  1. 01

    Find the right elevation for a card by adjusting sliders against a live preview

  2. 02

    Build a two-layer shadow: a tight contact shadow plus a soft ambient one

  3. 03

    Rebuild a shadow from a design file by entering its offsets, blur and color

  4. 04

    Get the Tailwind arbitrary-value form of a custom shadow

05 · Examples

CSS Box Shadow Generator examples

One layer: Y 4px, blur 16px, black at 8% opacity (the default)

ex 01

box-shadow: 0px 4px 16px 0px rgba(0, 0, 0, 0.08);

A subtle card-elevation shadow.

Card preset: two layers

ex 02

box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05), 0px 4px 12px 0px rgba(0, 0, 0, 0.08);

A tight near-surface shadow stacked with a softer ambient layer.

Focus ring preset: spread 3px, #3b82f6 at 45% opacity

ex 03

box-shadow: 0px 0px 0px 3px rgba(59, 130, 246, 0.45);

Zero offset and zero blur turn box-shadow into a ring that takes no layout space.

Inset preset

ex 04

box-shadow: inset 0px 2px 4px 0px rgba(0, 0, 0, 0.10);

An inset shadow along the top edge reads as the surface being pushed in.

Tailwind output for the default shadow

ex 05

shadow-[0px_4px_16px_0px_rgba(0,0,0,0.08)]

An arbitrary value; underscores stand for spaces.

06 · FAQ

Box Shadow: frequently asked questions

What is shadow spread?

Spread grows (positive) or shrinks (negative) the shadow before blur is applied. A positive spread creates a halo; a negative spread pulls the shadow in so it shows only on the side it is offset toward.

What ranges do the sliders cover?

Offset X, offset Y and spread run from -40px to 40px, blur from 0 to 80px and opacity from 0 to 100%. Color is a hex value; the tool combines it with the opacity into an rgba() color. You can stack 1 to 6 layers.

Should I use inset shadows?

Inset shadows render inside the element. They suit pressed-button states and inner edges, but readable depth usually comes from outset shadows. Tick Inset on any layer to switch it.

How do I avoid a flat, generic-looking shadow?

Single hard shadows tend to look generic. Stack two or three layers, a tight near-surface shadow plus a softer ambient one, and tint the color slightly toward the surrounding hue instead of pure black. The Card and Hover presets are two-layer starting points.

How do I make a shadow that still reads in dark mode?

Black shadows disappear against dark surfaces because there's nothing left to darken. Two things work instead: a hairline border a little lighter than the surface, or an inset highlight along the top edge that mimics a light source. Keep the drop shadow too, but expect it to do almost none of the work.

What's the difference between box-shadow and drop-shadow?

box-shadow follows the element's border box, so a transparent PNG casts a rectangular shadow. filter: drop-shadow() follows the alpha channel, so it traces the actual shape, which is the right choice for logos, icons, and cutouts. drop-shadow has no spread parameter. This tool generates box-shadow only.

Do box shadows hurt performance?

Large blur radii are expensive to repaint, and the cost scales with the blurred area rather than the element size. One big shadow is fine; dozens animating at once is not. If you need a shadow to change on hover, cross-fade a second pre-rendered layer's opacity rather than animating the shadow values.

07 · Reference

Specs and further reading

These are the primary sources this tool follows. Where a specification defines the behaviour, we link the specification, not a summary of it.

08 · More

Tools that pair with Box Shadow

Last updated .