Developer tool

CSS Box Shadow Generator

Adjust the shadow values and copy the CSS declaration for your stylesheet.

Runs in your browser. No upload.

Values are processed locally in this browser.

Result

—

About this tool

CSS Box Shadow Generator made simple.

The generator outputs one shadow declaration. Preview it in your own layout and check visibility, contrast and reduced-motion or high-contrast needs.

Guide

Using CSS Box Shadow Generator

The CSS Box Shadow Generator writes one box-shadow line for you to paste into a stylesheet. You set the horizontal and vertical offset, blur, spread, colour, opacity and whether the shadow is outside or inset. The colour and opacity are combined into an rgba value. It makes a single shadow only, and it shows no live preview, so you check how it looks in your own page.

How to use it

  1. Enter the horizontal and vertical offsets, blur and spread, all in pixels. Negative offsets move the shadow left or up.
  2. Type the shadow colour as a hex code, with three or six digits, and set the opacity from 0 to 100 percent.
  3. Choose Outside for a normal shadow or Inset to draw it inside the box.
  4. Press Calculate and copy the line from the Result box. Paste it into a rule, such as .card { ... }.

Worked examples

A soft shadow under a card

You enter
X
0
Y
8
Blur
24
Spread
0
Color
#000000
Opacity
18
Position
Outside
You get
Css
box-shadow: 0px 8px 24px 0px rgba(0, 0, 0, 0.18);

Black at 18 percent opacity becomes the alpha value 0.18. The shadow sits 8 pixels below the box and is blurred over 24 pixels.

Run through the tool’s own code.

An inset shadow with a short colour code

You enter
X
2
Y
-3
Blur
6
Spread
1
Color
#36c
Opacity
50
Position
Inset
You get
Css
box-shadow: inset 2px -3px 6px 1px rgba(51, 102, 204, 0.5);

The short code #36c is read as #3366cc, which is 51, 102, 204. The word inset comes first, and the shadow is drawn inside the box.

Run through the tool’s own code.

A hard ring with no blur

You enter
X
0
Y
0
Blur
0
Spread
4
Color
ff8800
Opacity
33
Position
Outside
You get
Css
box-shadow: 0px 0px 0px 4px rgba(255, 136, 0, 0.33);

With zero offset and blur, a spread of 4 pixels draws a sharp ring around the box. The leading # on the colour is optional.

Run through the tool’s own code.

A colour name is not accepted

You enter
X
0
Y
8
Blur
24
Spread
0
Color
red
Opacity
18
Position
Outside
You get
Message
Shadow color must be a 3- or 6-digit hex color, such as #336699.

Only hex codes work. A name like red, or a code with eight digits, is refused, and no line is produced.

Run through the tool’s own code.

When it helps

  • Create a soft card shadow for a web page or a design system.
  • Add a pressed-button look with an inset shadow.
  • Draw a sharp outline ring around an input field using spread alone.
  • Turn a design file's shadow numbers into a ready-to-paste CSS line.

Limits to keep in mind

  • Offsets must stay within 100 pixels in either direction, blur from 0 to 200 pixels and spread within 100 pixels either way. Opacity runs from 0 to 100 percent.
  • The colour must be a 3 or 6 digit hex code. Colour names, rgb(), hsl() and eight-digit hex with built-in alpha are not accepted.
  • It writes one shadow only. Stacked shadows, which are separated by commas in CSS, need to be joined by hand.
  • There is no live preview in the tool, and it cannot judge contrast, visibility or how the shadow looks in high-contrast or reduced-effects settings.

Tips

  • Use a low opacity with a large blur for a natural, soft shadow and a higher opacity with little blur for a crisp one.
  • Paste the line into your page and look at it on both light and dark backgrounds, as shadows read differently on each.
  • Do not rely on a shadow alone to mark a boundary or a focus state, since some people cannot see it.

Sources

Common questions

About CSS Box Shadow Generator.

What do the four numbers in box-shadow mean?

In order they are the horizontal offset, the vertical offset, the blur radius and the spread radius. Positive horizontal moves the shadow right and positive vertical moves it down. Blur softens the edge, and spread makes the shadow bigger or smaller than the box.

What does inset do?

Inset draws the shadow inside the box instead of behind it, which can make an element look pressed in. The tool adds the word inset at the start of the line when you pick it. Outside leaves it out and gives a normal shadow.

Why does the tool use rgba and not my hex code?

The opacity box needs a way to carry transparency, so the tool converts your hex colour into red, green and blue numbers and adds the opacity as the alpha value. The shadow looks the same, only written in another form.

Can I make more than one shadow?

Not in this tool, which writes one shadow per run. In CSS you can list several shadows in one box-shadow value, separated by commas. Make each one here, then join them with commas by hand.

Why is there no preview box?

The tool returns only the text of the CSS line. Add it to a test page or your browser's developer tools to see it on the real element. This also shows how it looks next to your own colours and spacing.

Why do I get an error for a value I think is fine?

Check the limits. Offsets and spread must be within 100 pixels, blur between 0 and 200, opacity between 0 and 100, and the colour a 3 or 6 digit hex code. Any empty box or non-number also gives an error.

Is anything sent to a server?

No. The line is built from your numbers by code running in your browser tab, and the values you type are not uploaded. The result only goes to your clipboard if you press Copy result.

How do I use CSS box shadow generator?

Adjust the shadow values and copy the CSS declaration for your stylesheet.

Is my data uploaded to a server?

No. This tool runs locally in your browser. Your input is not uploaded.