Skip to content
QueenNexa

Free tool

CSS Box Shadow Generator

Design a CSS box shadow with sliders, stacked layers, inset shadows and opacity, see it live, and copy the box-shadow CSS. Runs entirely in your browser.

Runs entirely in your browser. Nothing you type or upload is sent to our servers.

How to make a CSS box shadow

  1. Adjust the horizontal and vertical offset, blur and spread of the first layer.
  2. Pick a color and an opacity. Low opacity usually looks more natural than a solid color.
  3. Add layers for more depth, or tick Inset for an inner shadow.
  4. Copy the CSS and paste it into the rule for your element.

Worked examples

A soft card shadow: 0 horizontal, 4px vertical, 12px blur, 0 spread and black at 25 percent opacity gives this line. The zero values are written without units, and 25 percent opacity becomes an alpha of 0.25:

box-shadow: 0 4px 12px 0 rgba(0, 0, 0, 0.25);

A two-layer shadow: a tight 1px 2px shadow and a wide 8px 24px shadow with a negative 4px spread, both a dark slate at low opacity:

box-shadow: 0 1px 2px 0 rgba(15, 23, 42, 0.2), 0 8px 24px -4px rgba(15, 23, 42, 0.25);

An inner outline: an inset layer with no blur and a 2px spread in blue at full opacity is written as a hex color:

box-shadow: inset 0 0 0 2px #3b82f6;

What the output follows

  • Values are written in the order inset (if set), horizontal offset, vertical offset, blur, spread, color.
  • Layers are separated by commas.
  • Offsets and spread accept -200 to 200 pixels; blur accepts 0 to 200.

Fill the element with the CSS gradient generator, pull a color from a screenshot with the image color picker, or paste your CSS and markup into the HTML viewer to check it.

Frequently asked questions

What do the offset, blur and spread values do?

The horizontal and vertical offsets move the shadow away from the box, and negative numbers move it the opposite way from positive ones. Blur softens the shadow's edge, with 0 giving a sharp edge. Spread makes the shadow larger or smaller than the box. The preview updates as you change each number, so you can see each effect directly.

How do I make a soft, natural-looking shadow?

Use a small vertical offset, a larger blur and a low opacity, such as 0 4px 12px at 25 percent black. For more depth, stack two layers: a tight, faint shadow for the contact edge and a larger, softer one for the glow. The layered example on this page does exactly that.

What does inset do?

Ticking Inset draws the shadow inside the element's box instead of behind it. Inset shadows are often used for pressed buttons and inner borders. A spread-only inset shadow with no blur, as in the inset example on this page, works like an inner outline.

Can I use more than one shadow?

Yes. You can add up to 6 layers, and the tool writes them as one comma-separated box-shadow value. Each layer has its own offsets, blur, spread, color, opacity and inset setting, and you can remove layers you no longer need. At least one layer is always kept.

Why is my color written as rgba()?

When a layer's opacity is below 100 percent, the tool writes its color as rgba(red, green, blue, alpha), for example rgba(0, 0, 0, 0.25). At full opacity it writes a six-digit hex color instead. Both forms give the same color, so use whichever your stylesheet prefers.

What ranges are allowed?

Offsets and spread can be from -200 to 200 pixels, blur from 0 to 200 pixels and opacity from 0 to 100 percent. Blur cannot be negative. A value outside a range shows a message and the CSS is not updated until it is fixed. Zero is written without a unit, as 0.

Is anything saved or uploaded?

No. The preview and the CSS are made in your browser. Nothing is stored or sent, and reloading the page resets the tool to its starting shadow, so copy the CSS first if you want to keep it.

Link to this tool

Found it useful? Copy a link for your page, newsletter or documentation.

Get new tools and guides by email

Optional. The tool above works without signing up.

One email every Tuesday. Free, and you can unsubscribe in one click.

More free tools

Browse all developer tools or the full list of free tools.