CSS box-shadow generator
Tune box-shadow for any element with up to 8 stacked layers, each with its own offset, blur, spread, color and inset flag, a live preview, copyable CSS and an optional matching text-shadow.
Runs in your browserEvery computation happens in your browser — your data never leaves this device.
Shadow presets
Shadow layers
Up to 8 layers, painted in the order written (the first one sits on top).
Preview element
Live preview
The preview element and the generated .box rule read the same parameters; enable the text shadow to see it on the preview text too.
Generated CSS
Multiple box-shadow layers are listed line by line, comma separated; enabling the text shadow appends a .text rule.
.box {
width: 160px;
height: 160px;
background: #ffffff;
border-radius: 12px;
box-shadow:
0px 4px 12px 0px rgba(0, 0, 0, 0.15);
}What this tool does
- Tune card, popover or button shadows: stack layers, adjust offset and blur per layer, then copy the .box rule
- Build inset shadows or neon glows: one inset layer or several stacked layers with rgba controlling each intensity
- Generate a matching text shadow: tick the option to also get the .text rule from the same parameters
Example
Input
1 layer: 0px 4px 12px 0px rgba(0, 0, 0, 0.15) · element 160×160 · radius 12px · background #ffffff
Output
.box {
width: 160px;
height: 160px;
background: #ffffff;
border-radius: 12px;
box-shadow:
0px 4px 12px 0px rgba(0, 0, 0, 0.15);
}This is the real output for the page defaults; the preview element uses exactly the same parameters.
Frequently asked questions
How many layers can I stack, and does order matter?
Up to 8 layers (the add button disables at the limit). Layers are painted in the order written, with earlier entries on top, so writing the small near shadow first and the large far shadow last looks most natural. Each layer can be inset independently.
What are the limits and supported color formats?
Offsets within ±100px, blur 0–200px, spread within ±100px, element size 40–320px and radius 0–160px, all integers; out-of-range values report a specific error code and stop the output. Colors accept #rgb / #rgba / #rrggbb / #rrggbbaa, rgb() / rgba() and the 16 basic CSS color keywords; hsl() and similar notations report invalid-color.
How does text-shadow differ from box-shadow?
Text shadows have no spread radius, so the .text rule writes only X, Y, blur and color, with its own limits (±50 offset, 0–100 blur). Ticking the text-shadow option emits the .text rule alongside the .box rule, both validated from the same parameters.
What do the presets overwrite?
The five presets (soft, card with two layers, floating, inset, neon) only replace the shadow layers. Element width, height, radius, background and the text shadow settings are left untouched so you can compare shadows on the same element.
Do the preview and the generated CSS share the same data?
Yes. The preview element style comes from previewBoxStyle and previewTextStyle, and the CSS from buildShadowCss, both reading the same validated config. This tool generates CSS only, not the HTML markup.
Keywords:text-shadowCSS box-shadow generatorcss_divyinying