CSS Box Shadow Generator
Adjust a shadow with sliders, preview it live and copy the box-shadow rule.
The controls
Set Offset X and Y, Blur, Spread, colour and opacity, and tick Inset for an inner shadow.
Design tips
Soft, low-opacity shadows with a larger blur look natural. Hard, dark shadows with no blur look flat and heavy.
How to use it
- Move the offset, blur and spread controls.
- Choose the colour and opacity.
- Copy the CSS under the preview.
Default output
With the default settings:
box-shadow: 0px 10px 24px 0px rgba(0,0,0,0.25);
Common use cases
- Cards, modals and dropdowns.
- Pressed or inset button states.
- Matching shadows to a design file.
What each control writes
The tool assembles a single shadow in this order: optional inset, X offset, Y offset, blur, spread, then an rgba() colour. The colour comes from the colour picker plus the Opacity percentage divided by 100. Starting values are X 0, Y 10, Blur 24, Spread 0, black at 25 percent, so the output is:
box-shadow: 0px 10px 24px 0px rgba(0,0,0,0.25);
Two other settings give typical results. A subtle card shadow: X 0, Y 2, Blur 8, Spread 0, opacity 12 gives 0px 2px 8px 0px rgba(0,0,0,0.12). A hard offset 'sticker' style: X 4, Y 4, Blur 0, Spread 0, opacity 100 gives 4px 4px 0px 0px rgba(0,0,0,1). The colour is always converted to RGB, so you will not get a HEX value in the output.
Practical recipes
- Elevation: raise the Y offset and the blur together. A shadow that moves 4px down should usually be blurred around 12px; blur much smaller than the offset reads as a separate hard edge.
- Focus ring look: X 0, Y 0, Blur 0, Spread 3 and a coloured, 40 percent opaque colour makes a solid ring that does not affect layout, unlike a border.
- Pressed button: tick Inset with Y 2 and Blur 4 for a recessed effect.
- Shrunk shadow: a negative Spread such as -6 with a larger Y offset keeps the shadow under the element, a technique often used for a floating look.
Because the shadow is drawn from the element's border box, it follows border-radius. Preview the shadow with the radius you will use in the real design.
Limits and tips
This tool builds exactly one shadow, so layered shadows have to be assembled by hand by pasting the value of two or more shadows separated by commas, for example box-shadow: 0 1px 2px rgba(0,0,0,0.1), 0 8px 24px rgba(0,0,0,0.15);. Two layers, one tight and one wide, usually look more natural than a single large blur.
The preview is a plain box on the page background, so check the real component on its actual background. Shadows on dark backgrounds are barely visible with black, and designers often use a darker tinted colour instead. Remember box-shadow does not affect layout and will be clipped by an ancestor with overflow: hidden. For shadows that follow transparent PNG shapes, filter: drop-shadow() is the right property, which this tool does not generate.
Frequently asked questions
What does spread do?
It grows or shrinks the shadow beyond the element's edges.
What is an inset shadow?
A shadow drawn inside the element's border.
Can I stack several shadows?
This tool builds one shadow; you can combine rules by hand with commas.
Is my data uploaded?
No. This tool runs entirely in your browser, so what you type or paste is not sent to our servers.
Why does my output use rgba instead of HEX?
The opacity setting needs an alpha channel, so the colour is written as rgba(r,g,b,alpha). Use the Color Converter if you need the HEX of the colour.
Can I add a second shadow?
Not in the tool. Copy the first rule, generate another, and join the values with a comma inside one box-shadow declaration.