A css box shadow generator creates depth with light instead of guesswork. Shadows make cards lift, buttons press, and modals float — but the five-value box-shadow syntax is fiddly to tune by hand, and one wrong number turns “subtle elevation” into a muddy smear. Good shadows follow physics: a soft, large blur for ambient light plus a tight, darker contact shadow. Layering two or three shadows this way is what makes interfaces feel expensive.
This free css box shadow generator gives you sliders for every value, layered shadows, inset support, live preview on light or dark backgrounds, and one-click CSS copy. No signup, everything runs in your browser. Start from curated presets — subtle card, floating modal, glowing button — then fine-tune each layer until the depth looks right.
CSS Box-Shadow Generator
Design layered, realistic shadows visually — copy the CSS in one click.
🔒 100% private — everything runs in your browser, nothing is uploaded.
How to Use the CSS Box Shadow Generator
- Drag the sliders — X offset, Y offset, blur, and spread — and watch the preview update live.
- Pick a color and opacity. Dark neutrals at 8–25% opacity look realistic; colored shadows create glow effects.
- Toggle Inset for inner shadows (pressed buttons, input fields).
- Add layers (up to 5) for complex, realistic depth — or start from a preset: Subtle, Card, Floating, Glow, Inner.
- Toggle the dark background to check how the shadow reads on dark UI.
- Copy the CSS — one
box-shadowdeclaration, ready to paste.
Features That Set This Tool Apart
- Up to 5 layered shadows — comma-separated layers like professional design systems use.
- Every value labeled — this css box shadow generator teaches the syntax while you design.
- Inset support per layer for inner shadows.
- Opacity slider — alpha handled via rgba so you never hand-convert hex.
- Five one-click presets — realistic starting points from subtle to glow.
- Light/dark preview toggle — shadows behave differently on dark backgrounds; check both.
- Clean output — a single standard
box-shadowdeclaration, no prefixes. - Private and instant — runs entirely in your browser.
CSS Box Shadow Generator: Understanding Each Value
The full syntax is box-shadow: [inset] offset-x offset-y blur-radius spread-radius color;. Here is what each does:
- Offset X / Y — how far the shadow shifts horizontally and vertically. Positive Y drops the shadow below the element, mimicking overhead light.
- Blur radius — how soft the shadow’s edge is. 0 gives a hard, flat edge; 30px+ gives a dreamy haze. Larger blurs also fade the shadow’s apparent darkness.
- Spread radius — grows (positive) or shrinks (negative) the shadow’s size before blurring. Negative spread with large blur creates the tight, realistic “ambient” shadow under cards.
- Color + opacity — almost always a dark neutral with low alpha. Pure black at high opacity looks dirty; colored shadows (blue, brand color) create intentional glow effects.
- Inset — flips the shadow inside the element’s frame, for pressed states and recessed panels.
Multiple shadows are comma-separated and stack front-to-back. See the MDN box-shadow reference for the complete specification.
5 Shadow Design Principles
- One light source. Keep all shadows on a page offset in the same direction — mixed directions look broken.
- Elevation = blur + distance. Higher “elevation” means larger Y offset, larger blur, and softer (lower) opacity — like Material Design’s elevation scale.
- Layer two shadows. A tight dark layer plus a wide faint layer mimics real ambient occlusion far better than one shadow.
- Soften, don’t darken. When a shadow looks harsh, lower the opacity before shrinking the blur.
- Respect dark mode. Shadows nearly disappear on dark backgrounds — use lighter glows or borders for elevation instead.
box-shadow vs. filter: drop-shadow()
box-shadow follows the element’s box (respecting border-radius), which is what you want for cards, buttons, and panels. The filter: drop-shadow() function instead follows the rendered silhouette — including transparent regions of PNGs and the actual glyphs of text. Use drop-shadow for logos with transparency, icons, and text effects; use box-shadow for everything rectangular. Note that filters create a new containing block, which can affect positioned children — another reason to prefer box-shadow for layout components.
Real-World Shadow Recipes
Start from these proven values, then tweak in the generator:
- Subtle card:
0 1px 3px rgba(15,23,42,.10)— barely-there lift for content cards. - Elevated card:
0 2px 6px rgba(15,23,42,.08), 0 12px 24px -6px rgba(15,23,42,.12)— the classic two-layer combination. - Floating modal:
0 24px 48px -12px rgba(15,23,42,.25)— big blur, negative spread, higher opacity for dialogs. - Pressed button (inset):
inset 0 2px 4px rgba(15,23,42,.15)— inner shadow for active states. - Glow CTA:
0 0 24px rgba(37,99,235,.45)— a colored shadow for primary buttons, especially on dark backgrounds. - Navbar hairline:
0 1px 0 rgba(15,23,42,.06)— a 1px shadow that reads as a crisp divider.
Notice the pattern: realistic shadows pair a tight layer with a wide, faint one, and opacities stay low. Build your own variations in this css box shadow generator — start from the closest preset and adjust one slider at a time.
Dark-mode note: on dark backgrounds, dark shadows vanish. Switch to faint light glows or use borders for separation instead, and toggle the generator’s dark preview to check both themes before shipping.
Interactive shadows: grow the shadow on hover to signal clickability — for example, from the subtle card recipe to the elevated one. Animate with transition: box-shadow .2s and keep the change small so it feels responsive rather than jumpy.
CSS Box Shadow Generator: Frequently Asked Questions
How do I create a box shadow with this tool?
Adjust the sliders for horizontal offset, vertical offset, blur, and spread, then pick a color and opacity. Toggle inset for inner shadows, add extra layers for complex effects, and watch the preview update live. The CSS appears below — copy it straight into your stylesheet.
What do the box-shadow values mean?
The syntax is offset-x, offset-y, blur-radius, spread-radius, color. Offsets move the shadow; blur softens its edges; spread grows or shrinks it; the color sets its tint. The optional inset keyword flips the shadow inside the element. This tool labels every slider so you learn the syntax as you design.
How do I make a realistic soft shadow?
Use a large blur (20–40px), zero or small spread, a modest vertical offset, and low opacity (10–25%) in a neutral dark color. Layering two shadows — one tight and dark, one wide and faint — mimics real ambient occlusion better than any single shadow. Try the Card or Floating presets as starting points.
What is the difference between box-shadow and drop-shadow?
box-shadow follows the element’s rectangular (or border-radius) box, while the drop-shadow filter follows the rendered shape including transparent image areas and text glyphs. Use box-shadow for cards and buttons, drop-shadow for PNGs with transparency or text effects.
Do box shadows hurt website performance?
A few small shadows are harmless, but many large blurred shadows — especially animated ones — force expensive repaints and can jank scrolling on low-end phones. Prefer transform and opacity for animations, keep blur radii modest, and test on a real device.
Related Free Tools
- CSS Gradient Generator — design linear, radial, and conic gradients visually.
- CSS Minifier — compress stylesheets for faster page loads.
- Color Palette + Contrast Checker — build accessible color combinations.
- All Free Tools — browse the complete collection of free online tools — no signup needed.
Depth is a design material — spend it deliberately. With this css box shadow generator you can dial in exactly the elevation your UI needs and ship the CSS in seconds.