CSS box-shadow generator

A CSS box-shadow generator writes the box-shadow property for you: horizontal offset, vertical offset, blur, spread and color, for example box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15). Adjust the sliders and copy the line.

Design a shadow on a real card or button, see it live, and copy one clean box-shadow declaration.

How to use the generator

  1. Start from a preset or type values into the offset, blur, spread and opacity fields. Arrow keys nudge each number by 1.
  2. Pick the shadow color, then set the surface and background colors to match your design.
  3. Switch between the card and button preview, tick Inset for an inner shadow, and press Copy CSS.

Project update

Three screens are ready for review.

Your CSS

box-shadow: 0px 8px 24px -6px rgba(15, 23, 42, 0.18);

Copy-ready box-shadow examples

Soft resting card

box-shadow: 0px 8px 24px -6px rgba(15, 23, 42, 0.18);

Hard offset button

box-shadow: 4px 4px 0px 0px rgba(17, 24, 39, 1);

Pressed input field

box-shadow: inset 0px 2px 4px 0px rgba(15, 23, 42, 0.2);

Focus ring without blur

box-shadow: 0px 0px 0px 3px rgba(37, 99, 235, 0.45);

Inset and spread explained

The inset keyword draws the shadow inside the element's border instead of outside it, which makes a surface look pressed in. Use it for input fields, toggles in the on state and wells. Spread grows the shadow on every side before it is blurred; a positive spread makes it bigger than the element, and a negative spread shrinks it so a soft shadow peeks out only where you offset it. With zero blur and a spread of a few pixels, a shadow becomes a crisp outline that does not change layout, which is why it works well as a focus ring.

Study shadows on real interfaces

See how live products use elevation on cards, menus and dialogs, then recreate the effect here.

Frequently asked questions

What is the order of values in box-shadow?

The syntax is an optional inset keyword, then the horizontal offset, vertical offset, blur radius, spread radius and color, for example 0 4px 12px -2px rgba(0, 0, 0, 0.2). Only the two offsets are required. Offsets and spread can be negative, but blur cannot. A negative horizontal offset moves the shadow left, and a negative vertical offset moves it up.

What do blur radius and spread radius do?

Blur radius softens the shadow's edge: 0 gives a hard, crisp edge, and larger values fade it out over a wider area. Spread radius changes the shadow's size before it is blurred: a positive value grows it on every side, and a negative value shrinks it. A small blur with a negative spread gives a tight shadow that sits close to the element.

How do I make a shadow only on the bottom?

Use a vertical offset with a negative spread close to the blur size, for example 0 8px 8px -8px rgba(0, 0, 0, 0.3). The negative spread pulls the shadow in from the left and right edges so they stay hidden, while the vertical offset pushes the remaining shadow below the element, so only the bottom edge shows.

Does box-shadow affect layout or performance?

No. A shadow takes up no space in the layout, so it never moves or resizes neighbouring elements, and it is not counted in the element's width or height. A parent with overflow: hidden will clip it, though, so leave room with padding. Very large blur values on many elements can slow scrolling, so keep blur modest on long lists.

More CSS generators

Color tools

Image tools

Image & SVG tools

Typography & units

More free tools

All free tools