Free developer tool

CSS Box Shadow Generator

Set the offsets, blur, spread, color and opacity to see the shadow on a preview card, then copy the box shadow CSS line for your project.

Report a problem or suggest a fix for this tool

What is css box shadow generator?

A box shadow adds depth to cards, buttons, menus and images. Soft, low opacity shadows look natural, while hard dark ones look heavy.

This generator shows the result live and writes the CSS for you, including a proper rgba color so you can control opacity.

How to use the css box shadow generator

  1. Move the values until the preview looks right.
  2. Pick the shadow color and opacity.
  3. Copy the CSS line.

How the css box shadow generator works

The shadow is written as offset x, offset y, blur, spread and a color. The hex color and opacity are converted to an rgba value. The inset option places the shadow inside the box.

Worked example

A card shadow of 0 8px 24px 0 at 20 percent black reads a box shadow line with 0px 8px 24px 0px rgba(0, 0, 0, 0.20).

Common uses of the css box shadow generator

  • Card and panel design.
  • Button hover effects.
  • Modal and menu depth.
  • Image frames.
  • Learning how shadows work.

Tips and common mistakes

Use a larger blur and lower opacity for a soft look.

Match the shadow direction across your whole design.

Background: what to know before you rely on it

Shadows tell the eye which elements sit above others. Material and many modern design systems use layered shadows, a tight dark one for contact and a wide soft one for height. This generator makes one layer, and you can combine several by hand. Large blurs on many elements can slow rendering on weak devices, so use them with care on long lists. Keep opacity low and color slightly tinted toward your background for the most natural result.

Private, free and fast

This tool runs entirely in your browser. What you type or choose is not uploaded to a server and is not saved after you close the page, which keeps it fast and private. It is free to use as often as you like. See more in all developer tools, or browse the full list of tools.

Field by field guide

  • Horizontal offset (px): Enter a number. The example value is 0.
  • Vertical offset (px): Enter a number. The example value is 8.
  • Blur (px): Enter a number. The example value is 24.
  • Spread (px): Enter a number. The example value is 0.
  • Color: Pick a color.
  • Opacity (0 to 100): Enter a number. The example value is 20.
  • Inset shadow: Tick to turn this option on.

Change one field at a time to see how the result responds, and use the worked example above to check that you get the same answer.

Designing shadows that look real

A shadow has an offset, a blur, a spread and a color. Real shadows are soft and light colored, so avoid pure black at full strength.

Expert tips

  • Use a low opacity black such as rgba(0,0,0,0.12) rather than solid gray.
  • Layer two shadows, one small and tight and one large and soft, for a natural depth effect.
  • Keep the light direction the same across the page, usually from above, with a positive vertical offset.
  • Use a larger blur for elements that appear higher, such as modals, and a smaller one for cards.
  • Test dark mode, where shadows are hard to see and borders or lighter overlays work better.

Large blurs on many elements can slow scrolling on weak phones. Keep heavy shadows for a few key items.

Frequently asked questions

What does spread do?

It grows or shrinks the shadow before blur is applied.

What is an inset shadow?

A shadow drawn inside the box, often used for pressed buttons.

Can I stack shadows?

Yes, separate several shadows with commas in the CSS.

Does it work on text?

No. Use the text shadow property for text.

Embed this tool on your website

Copy the code below and paste it into your page or blog post. The tool is free to embed, runs in the visitor's browser and needs no account. Please keep the credit link.

Related tools

Results are for information and education. For legal, financial, medical or security decisions, check with a qualified professional. Do not paste live secrets into any website.