Stax
Tools

CSS Box Shadow Generator

Generate CSS box-shadow visually with live preview.

Horizontal (X)4px
Vertical (Y)4px
Blur radius10px
Spread radius0px
Opacity25%
Color
box-shadow: 4px 4px 10px 0px rgba(0, 0, 0, 0.25);

How the CSS Box Shadow Generator works

The CSS box shadow generator provides a visual interface for designing box-shadow values without memorising the property syntax. Drag sliders for horizontal offset, vertical offset, blur radius, spread radius, and colour — the live preview updates instantly. Copy the finished CSS declaration (including vendor prefixes if needed) for direct use in your stylesheet or design system token.

Box-shadow syntax explained

The full CSS box-shadow syntax is: box-shadow: [inset] h-offset v-offset blur spread color. Positive h-offset casts shadow to the right; negative to the left. Positive v-offset casts downward; negative upward. Blur radius creates softness — 0 is a hard edge. Spread radius expands or contracts the shadow beyond the element's dimensions. The optional inset keyword moves the shadow inside the element's border, creating recessed or pressed effects.

Material Design elevation shadows

Google's Material Design system defines elevation levels using layered box shadows. Elevation 1dp uses a very subtle shadow; elevation 24dp (for dialogs) uses a strong, multi-layer shadow. The generator includes Material Design elevation presets so you can match the standard shadow values precisely — important for maintaining visual consistency in design systems that follow Material guidelines rather than inventing shadow values from scratch.

Neumorphism and multi-layer shadows

Neumorphism (soft UI) creates embossed or debossed surfaces using two box shadows — one light (top-left, white, low opacity) and one dark (bottom-right, black, low opacity) against a matching background colour. The CSS box-shadow property accepts multiple shadow values separated by commas, all applied simultaneously. The generator supports up to 4 simultaneous shadow layers, enabling neumorphic effects, coloured glow borders, and complex elevation stacking in a single property value.

Performance and compositing

CSS box shadows are GPU-composited in modern browsers when the element is on its own compositing layer (triggered by transform, opacity, or will-change). However, adding box-shadow to elements that change frequently (e.g., on hover without transition) or to elements inside scroll containers can trigger layout and paint, degrading performance. For smooth animated shadows, animate opacity on a pseudo-element shadow instead. The generator's output notes where transition: box-shadow is safe to add.

Frequently asked questions

What are the box-shadow parameters?
box-shadow takes: horizontal offset (X), vertical offset (Y), blur radius, spread radius, and color. A negative X moves the shadow left; negative Y moves it up. Spread expands or contracts the shadow size.
What does 'inset' do?
The inset keyword moves the shadow to the inside of the element (inner shadow) instead of outside. This is useful for creating pressed-button effects or inner glows.
Can I add multiple box shadows?
Yes. Click '+ Add' to add another shadow layer. CSS supports comma-separated multiple shadows, with the first shadow drawn on top. Each shadow h own independent settings.
How do I use the generated CSS?
Click 'Copy' and paste the box-shadow property into your CSS file or style attribute. The output is valid CSS3 that works in all modern browsers.

Related tools