HandyBench

CSS Box Shadow Generator

Build CSS box shadows and copy the code.

box-shadow: 0px 10px 20px -5px rgba(0, 0, 0, 0.2);

How to use the CSS Box Shadow Generator

  1. 1 Adjust horizontal/vertical offset, blur and spread.
  2. 2 Pick a shadow color and opacity, and toggle inset if needed.
  3. 3 Copy the generated box-shadow CSS.

The five values of box-shadow

The generator writes a single shadow in this order: an optional inset keyword, horizontal offset, vertical offset, blur radius, spread radius, then a color. The color is built from your hex choice plus the opacity slider as an rgba() value.

box-shadow: 0px 10px 20px -5px rgba(0, 0, 0, 0.2);
ValueRange hereEffect
Horizontal and vertical-50 to 50 pxMoves the shadow; positive is right and down
Blur0 to 100 pxSoftness; a blur of 0 is a hard copy of the box. Negative values are invalid in CSS
Spread-50 to 50 pxGrows or shrinks the shadow before blurring
Opacity0 to 1, in steps of 0.01Alpha of the shadow color

The blur value is the width of the soft edge; in the CSS spec it is the diameter over which a Gaussian blur with a standard deviation of half that number is applied. So a 20 px blur fades out over roughly 20 px centered on the shadow's edge, and about 10 px of it sits inside the shadow's outline.

Why the default has negative spread

With a 10 px vertical offset, a 20 px blur and -5 px spread, the shadow is shrunk by 5 px on each side before blurring. It therefore peeks out mainly beneath the box and barely shows at the sides, which looks like a light source above rather than a glow all around.

Pitfalls specific to shadows

  • Clipping. A parent with overflow: hidden cuts off any shadow that extends beyond it. Add padding to the parent or move the overflow rule inward.
  • Animation cost. Animating box-shadow makes the browser repaint the shadow every frame. For hover effects, put the larger shadow on a pseudo-element and fade its opacity instead.
  • Large blurs on many elements. Long lists of cards each with a 100 px blur can slow scrolling on low-end phones.
  • Do not use shadow alone for meaning. In Windows High Contrast and other forced-colors modes, shadows are removed, so a focus ring made only from box-shadow disappears. Use outline for focus states.
  • Layering. This tool produces one layer. Realistic elevation usually stacks two or three shadows separated by commas; paste the output and add layers by hand.
  • Inset flips direction. With inset checked, the shadow is drawn inside the padding edge, so a positive vertical offset darkens the top, not the bottom.

Pair shadows with rounded corners from the border-radius generator; the shadow follows the box's curve.

Examples

  • ▸ A soft card shadow for depth.
  • ▸ An inset shadow to make an input look recessed.

Frequently asked questions

What do offset, blur and spread do?

Offset moves the shadow horizontally and vertically, blur softens its edge, and spread grows or shrinks the shadow’s size before the blur is applied.

What is an inset shadow?

An inset shadow is drawn inside the element instead of outside, which makes the box look pressed in or recessed — useful for inputs and wells.

How do I make a subtle, modern shadow?

Use a small vertical offset, a generous blur, a slightly negative spread, and a low opacity (around 0.1–0.2). This creates the soft, diffuse shadow common in modern UI.

Why is my shadow cut off on one side?

A parent element with overflow set to hidden clips anything that extends past its edge. Add padding to the parent or move the overflow rule to an inner element so the blur has room.

Can I layer several shadows?

CSS allows a comma-separated list of shadows on one element, but this generator outputs a single layer. Copy its result and add extra layers by hand for realistic multi-step elevation.