CSS · Design

Box Shadow Generator

Tune a box shadow visually and copy the CSS in one click.

box-shadow: 0px 8px 24px 0px rgba(30, 58, 138, 0.18);

What is Box Shadow Generator?

A box shadow generator helps you craft CSS box-shadow values with visual feedback. This tool exposes X offset, Y offset, blur radius, spread radius, color, opacity, and an inset toggle, then outputs a single box-shadow declaration you can copy.

The generated syntax follows the common form: optional inset, then four lengths in pixels, then an rgba() color built from your HEX and opacity. Multiple stacked shadows are not edited as layers here—you can combine copied values with commas in your stylesheet.

Designers often approximate elevation with multiple soft layers. This generator focuses on teaching one correct layer first—offsets, blur, spread, and alpha—so the CSS you copy behaves the same in every modern browser that supports box-shadow.

Why Use This Tool?

Shadows communicate elevation and focus. Tweaking blur and spread by eye in CSS is slow; a live preview shortens that loop.

Opacity-aware rgba output avoids hard black shadows that look muddy on colored backgrounds.

When you tokenize shadows as CSS variables, a single audited string prevents drift between Figma effect panels and production. Generating rgba() from HEX plus opacity also avoids hard-coded alpha mistakes.

  • Live preview card
  • Inset and outset shadows
  • Blur, spread, and offset controls
  • Copy-ready CSS

How Does This Tool Work?

Sliders update settings; boxShadowCss builds the string. HEX is parsed to RGB; opacity is clamped to 0–1; the color becomes rgba(r, g, b, a). Lengths are emitted in px.

Inset prefixes the value with inset when enabled—useful for pressed buttons or recessed wells.

Preview updates as you drag controls. Copy places the full box-shadow value on the clipboard for pasting into a rule, a custom property, or a utility class.

Understanding Your Results

Larger blur softens edges; spread grows or shrinks the shadow before blur. Positive Y often reads as light from above.

Very high opacity can look like a hard duplicate of the box. Prefer low opacity with larger blur for Material-like elevation.

Spread expands the shadow before blur applies. Negative spread can tighten a glow under a card. Inset shadows never cast outside the border box; they shade the interior instead.

Why Tracking This Matters

Consistent shadow tokens keep UI depth coherent across cards, menus, and modals.

Documenting the exact CSS string prevents design-dev drift from approximate Figma effects.

Elevation cues help people understand what is interactive or modal. Overdone shadows increase visual noise and can fight text contrast on light cards.

Benefits of Using Box Shadow Generator

  • Faster than hand-writing shadow syntax
  • Opacity control baked into rgba()
  • Inset support for recessed UI
  • Immediate visual feedback
  • Private local generation
  • Easy copy into design tokens

How Is the Result Calculated?

Output format: [inset ]Xpx Ypx blurPx spreadPx rgba(r, g, b, alpha). Invalid HEX falls back to black channels for the rgba() color.

There is no WCAG formula for shadows. Treat the output as presentation CSS. If a shadow sits under text, still verify foreground and background contrast separately.

[inset] Xpx Ypx blurpx spreadpx rgba(R, G, B, A)

X, Y
Horizontal and vertical offsets in pixels.
blur
Blur radius in pixels.
spread
Spread radius in pixels.
A
Alpha from the opacity control, 0–1.

Tips for Better Results

  • Start with Y=4–8, blur=12–24, opacity 0.1–0.25 for soft cards.
  • Use inset for inputs and toggles that should feel pressed.
  • Stack shadows by joining two copied values with a comma.
  • Check contrast of text on the shadowed surface separately.
  • Prefer tokenizing shadows in CSS variables for theme themes.
  • On dark themes, prefer lighter low-opacity shadows or rely more on borders—black shadows vanish on near-black surfaces.

Standards and References

Conclusion

Tune offset, blur, spread, and opacity until the preview matches the elevation you want, copy the box-shadow value, and store it as a token. Layer additional shadows in CSS when you need richer depth.

Keep shadow tokens few and purposeful—resting, raised, and overlay are enough for most products—and regenerate values here whenever brand elevation guidance changes.

Privacy & how it works

This design utility runs in your browser. Colors, CSS, and images you enter are not uploaded to The ToolSphere servers for this tool. Privacy Policy.

FAQ

Can I stack multiple shadows?expand_more

This UI edits one layer. Combine multiple values with commas in CSS.

What units are used?expand_more

Pixels for offsets, blur, and spread.

How is color opacity applied?expand_more

HEX is converted to RGB and paired with your opacity in rgba().

What does inset do?expand_more

It draws the shadow inside the box instead of outside.

Does spread work with inset?expand_more

Yes—spread still applies; preview to confirm the look.

Is filter: drop-shadow supported?expand_more

No. This tool outputs box-shadow only.

Are values uploaded?expand_more

No.

Is it free?expand_more

Yes.

Why does my shadow look different in Figma?expand_more

Rendering engines and effect models differ; treat CSS as the source of truth for the web.

Can I use rem instead of px?expand_more

Not in the generator output—convert afterward if your system requires rem.

Does the preview match every browser?expand_more

Modern engines agree closely on box-shadow; minor antialiasing differences can remain. Always spot-check in your target browsers for critical UI.

Is this tool free?expand_more

Yes. No signup and no paywall for core use.

Suggest an improvement

Tell us what would make this tool more useful. We read every suggestion.

Feedback for: Box Shadow Generator