# CSS Box Shadow Generator

URL: https://hifreetools.com/developer/box-shadow-generator

> Drag the sliders to design a CSS box-shadow, watch it update on a live preview box, and copy the exact box-shadow declaration with one click.

## Quick answer

A CSS box-shadow generator lets you set the horizontal and vertical offset, blur radius, spread radius, color, and opacity of a shadow visually, then gives you the ready-to-paste box-shadow declaration. The color and opacity are combined into an rgba() value, and an inset toggle switches between an outer drop shadow and an inner shadow.

The tool reads your hex color and converts it to red, green, and blue values, then combines them with the opacity slider (0–1) to build an rgba() color. It assembles the four box-shadow lengths in order — horizontal offset, vertical offset, blur radius, spread radius — each in pixels, and prepends the keyword "inset" when the inset toggle is on. The result is the standard CSS syntax box-shadow: [inset] h-offset v-offset blur spread color;. The same string drives both the copyable code and the inline style on the preview box, so what you see is exactly what you copy. Everything runs locally in your browser.

## Examples

- Soft drop shadow: h 4px, v 4px, blur 10px, spread 0px, color #000000, opacity 0.3, inset off → box-shadow: 4px 4px 10px 0px rgba(0, 0, 0, 0.3);
- Elevated card with negative spread: h 0px, v 8px, blur 24px, spread -4px, color #0a0a0a, opacity 0.25, inset off → box-shadow: 0px 8px 24px -4px rgba(10, 10, 10, 0.25);
- Inner (inset) shadow: h 0px, v 2px, blur 6px, spread 0px, color #1e3a8a, opacity 0.5, inset on → box-shadow: inset 0px 2px 6px 0px rgba(30, 58, 138, 0.5);

## FAQ

**What do the four box-shadow numbers mean?**
In order they are horizontal offset, vertical offset, blur radius, and spread radius, all in pixels. Positive horizontal moves the shadow right, positive vertical moves it down, blur softens the edge, and spread grows (positive) or shrinks (negative) the shadow.

**How is the rgba color built from my color and opacity?**
Your hex color is split into red, green, and blue values (0–255), and the opacity slider becomes the alpha channel from 0 (fully transparent) to 1 (fully opaque). For example #000000 at opacity 0.3 becomes rgba(0, 0, 0, 0.3).

**What does the inset option do?**
Inset draws the shadow inside the element instead of outside it, creating a recessed or pressed-in look. The generator simply adds the inset keyword to the front of the declaration.

**Can an element have more than one box-shadow?**
Yes. CSS lets you stack shadows by separating them with commas, like box-shadow: 0 1px 2px rgba(0,0,0,.1), 0 4px 12px rgba(0,0,0,.15);. This tool builds one shadow at a time, which you can combine manually for layered effects.

**Does a box-shadow change the element's size or layout?**
No. A box-shadow is painted outside the normal box and does not affect layout, so surrounding elements are not pushed away. If you need an edge that takes up space, use border instead (outline, like box-shadow, takes no space).

**Is box-shadow supported in all browsers?**
Yes. box-shadow is part of the CSS Backgrounds and Borders specification and is supported in every modern browser, including Chrome, Firefox, Safari, and Edge, with no vendor prefix needed.

**Is my data sent anywhere?**
No. The generator runs entirely in your browser, so your colors and settings never leave your device and there is no upload.


## Sources

- [MDN — box-shadow](https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow)
- [W3C — CSS Backgrounds and Borders Module Level 3](https://www.w3.org/TR/css-backgrounds-3/#box-shadow)
- [MDN — rgb() / rgba() color function](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/rgb)

Runs in the browser; nothing is uploaded. Cite as: HIFreeTools, "CSS Box Shadow Generator", https://hifreetools.com/developer/box-shadow-generator
