Design

CSS Shadow Generator

Build CSS box-shadow values visually, with the offset, blur, spread and layering that make a shadow look real.

Last reviewed by the Radiatus Cloud team

Need this done properly for your business?

Radiatus delivers secure cloud, DevOps & compliance engineering.

Book a free consult

The four values, in order

A box-shadow takes horizontal offset, vertical offset, blur radius and spread radius, then a colour. Offsets move the shadow, blur softens its edge, and spread grows or shrinks it before blurring. A negative spread pulls the shadow in, which is the trick for a tight shadow that does not bleed out from under the element.

Layer shadows rather than enlarging one

A single large blurred shadow reads as cheap. Real shadows are the sum of ambient occlusion close to the object and a softer cast shadow further out. Two or three comma-separated shadows, each with a progressively larger offset and blur and a lower opacity, produce a far more convincing result than one shadow at any setting. This is the single biggest difference between a shadow that looks designed and one that does not.

Light comes from above

Almost every interface assumes an overhead light source, so shadows fall downward: a positive vertical offset with zero or near-zero horizontal. A shadow offset sideways reads as wrong because it contradicts an assumption the viewer does not know they are making. Keep the direction consistent across every element on a page, or the surface stops feeling like one plane.

Use transparent black, not grey

A grey shadow looks dead over coloured backgrounds because it does not take on any of the underlying hue. Black at low alpha composites with whatever is behind it and stays believable everywhere. For a richer result, tint the shadow toward the complement of the surface colour rather than reaching for pure grey.

Inset shadows are a different tool

The inset keyword draws the shadow inside the element, which is how pressed buttons, input wells and neumorphic surfaces are made. Inset and outset shadows can be combined in one declaration, which is exactly how the soft-UI look is built.

Performance

Box-shadow is painted, not composited, so animating blur or spread forces repaints and can be janky on lower-end devices. Animate opacity or transform on a pseudo-element carrying the shadow instead, which the compositor can handle on the GPU.

Related tools

  • Color Converter — Convert colours between HEX, RGB, HSL, HWB and OKLCH, with alpha support. Runs in your browser and shows the live swatch for each format.
  • Accessibility Color Contrast Checker — Check foreground and background colour contrast against WCAG thresholds, with the rules for text size, UI components and states.
  • Typography Scale Generator — Generate a modular type scale from a base size and ratio, with fluid clamp() values for responsive layouts.
  • Design Token Generator — Generate design tokens as CSS variables, JSON or platform formats, structured in the layers that make them maintainable.

Frequently Asked Questions

What do the four box-shadow values mean?

Horizontal offset, vertical offset, blur radius and spread radius. Spread grows or shrinks the shadow before blurring, and a negative spread pulls it in to stop it bleeding out from under the element.

Why does my shadow look fake?

Usually it is one large blurred shadow. Real shadows combine tight ambient occlusion with a softer cast shadow, so two or three layered shadows at increasing offset and decreasing opacity look far more convincing.

Which direction should a shadow fall?

Downward, with a positive vertical offset and little or no horizontal, because interfaces assume an overhead light. Keep the direction identical across the page or the surface stops reading as one plane.

Should shadows be grey or black?

Black at low alpha. Grey looks dead over coloured backgrounds because it takes on none of the underlying hue, while transparent black composites with whatever is behind it.

Is animating box-shadow expensive?

Yes. It is painted rather than composited, so animating blur or spread forces repaints. Animate opacity or transform on a pseudo-element carrying the shadow instead.

Privacy & Security

Generated locally.

Data: None
Client-side-Side
Active
v1.0

About This Tool

This tool runs entirely in your browser. No data is sent to any server, ensuring complete privacy. Simply use the interface above to get started — no registration or login required.

Disclaimer: This tool is provided "as is" without warranty of any kind. Results are for educational and utility purposes.