CSS Box Shadow Generator

Controls

Preview

CSS Output

 

Full Rule

 

How to Use

  1. Set offset — Drag X/Y sliders to position the shadow.
  2. Blur & spread — Increase blur for soft edges; adjust spread to grow or shrink the shadow.
  3. Color & opacity — Pick a color and transparency. Dark semi-transparent shadows look most natural.
  4. Toggle inset — Enable for inner shadows on inputs or pressed buttons.
  5. Copy & paste — Hit "Copy CSS" and use directly in your stylesheet.

What Is CSS Box Shadow?

box-shadow draws shadows around an element's border box — no images needed. Each shadow consists of X/Y offset, blur, spread, and color.

Use inset for inner shadows. Shadows follow border-radius automatically. Stack multiple layers (tight key shadow + soft ambient) for realistic depth.

Common Use Cases

Card elevation
Modals & dropdowns
Button hover states
Inset input fields
Floating action buttons
Dark theme depth

Tips & Best Practices

Use rgba()

Keep opacity independent of hue — easier to tune across light and dark modes.

Stack two layers

A small dark shadow near the element plus a large soft ambient shadow creates realistic depth.

Consistent light source

Keep shadow direction the same (usually down-right) across your entire UI.

Performance

Avoid animating large blurs on many elements at once — it can hurt scroll performance on mobile.

Frequently Asked Questions

What is the difference between blur and spread?

Blur softens edges — higher values make it more diffuse. Spread changes the shadow size before blurring: positive grows it, negative shrinks it.

When should I use inset?

Use inset for pressed buttons, form fields, and recessed panels. Default (outer) shadows lift elements above the background.

Can I apply multiple shadows?

Yes. Use comma-separated values. This tool supports up to three layers — enough for key, ambient, and highlight shadows.

Box-shadow vs drop-shadow — which is better?

box-shadow follows the border box (cards, buttons). filter: drop-shadow() follows the alpha shape (icons, PNG cutouts).

Does box-shadow work in all browsers?

Yes. Supported without prefixes in all modern browsers. Test stacked shadows on target devices if using large blur values.