Just File Tools

Box Shadow Generator

Visual CSS box-shadow builder with offset, blur, spread, color, and inset

box-shadow
Layer 1

How to Box Shadow Generator Online

Build a CSS box-shadow visually with live preview, then copy the generated declaration.

  1. Adjust the X / Y offset, blur, and spread sliders to position and size the shadow.
  2. Pick a color and drag the alpha slider — lower alpha + higher blur produces a more natural look.
  3. Toggle Inset to cast the shadow inward (embossed or sunken look) instead of outward (lifted look).
  4. Click 'Add another shadow layer' to stack multiple shadows. Material Design uses 2 layers; Apple's macOS uses 3–4.
  5. Remove any layer with the trash icon next to its header. The last remaining layer cannot be removed.
  6. Click Copy on the CSS block at the bottom to paste the declaration into your stylesheet.

About Box Shadow Generator

The CSS `box-shadow` property is the single most-used visual primitive in modern web design after `color` and `border`. Every card, every dropdown, every modal, every elevated button uses it. The property syntax is simple — `x y blur spread color`, optionally prefixed with `inset` — but getting the values right by typing them blindly is hard, and small changes (a 2-pixel blur shift, a 0.1 alpha bump) produce visually large differences. A visual builder closes the loop.

The five tunable values map to physical-light intuition. **X and Y offsets** are where a light source would project the box's outline onto the surface behind it — direct overhead light gives zero X, small positive Y (shadow drops slightly downward); afternoon side-light gives larger X and Y in one direction. **Blur** is how soft the light is — a single point source (a spotlight) gives sharp edges and small blur; a diffuse source (an overcast sky, a large window) gives soft edges and high blur. **Spread** has no direct physical analog but acts like changing the box's size before casting the shadow — useful for the "wider than the box itself" look on hovers, or "tighter than the box" for subtle ambient grounding. **Color + alpha** together give you the apparent shadow intensity.

The convention for natural-looking shadows in modern design systems is unintuitive: **low alpha (0.05–0.25), high blur (20–60 px), and multiple layers.** A single `box-shadow: 0 10px 30px rgba(0,0,0,0.5)` produces something that looks like a hard-edged smudge under the box. The same shape with the alpha dropped to 0.15 and a second tight ambient layer added (`0 1px 2px rgba(0,0,0,0.08)`) reads as a real, grounded element. Material Design's elevation system, Apple's HIG, and most refined modern UIs all stack two to four layers like this. This tool lets you build the stack visually by adding additional layers via the "+" button.

The `inset` keyword inverts the direction. Without it, the shadow is cast on the surface *outside* the box, simulating light hitting the front of the box and projecting back. With it, the shadow falls on the surface *inside* the box, simulating either light hitting the front and being absorbed, or the box being pressed into its surface. Inset shadows are how you get the "pressed button" or "input field with a subtle inner shadow" look — common in older neumorphism designs and in form controls that want to indicate interactivity.

One specific design pattern worth knowing: **the "elevation token"**. Most design systems define a small number of named shadow values (elevation-1, elevation-2, etc.) and reuse them across every component. This means the design has visual consistency — every card uses the same shadow as every other card. Build your shadow once with this tool, copy the output, and store it as a CSS custom property (`--elevation-1: ...`) at the document root. Components reference `var(--elevation-1)` instead of redefining the shadow inline.

The output is plain CSS and works everywhere `box-shadow` does — which is every browser since 2010. Tailwind users can wrap the value in arbitrary-value syntax (`class="shadow-[...]"`) or extract the values into their config's `boxShadow` theme map. styled-components and Emotion accept the string verbatim. Inline styles work too: `style={{ boxShadow: '...' }}` in React.

Everything is browser-native — the preview is a rendered `<div>` with the same `style.boxShadow` you would write yourself, so what you see in the preview is exactly what your users will see in production. No network requests during interaction. The slider state lives only in this page's React tree until you copy the output.

Frequently Asked Questions

What does each slider actually do?

**X offset** moves the shadow left (negative) or right (positive). **Y offset** moves it up (negative) or down (positive). **Blur** softens the edges — 0 produces a hard-edged copy of the box, larger values produce a diffuse glow. **Spread** grows (positive) or shrinks (negative) the shadow before blur is applied. **Color** and **alpha** control the shadow's hue and transparency. **Inset** flips the shadow to cast inward, producing an embossed or pressed-in look.

Why use multiple shadow layers?

Realistic shadows are almost never one layer. Material Design's elevation system uses two layers — a tight ambient shadow and a longer, softer key shadow — to mimic real light. Apple's macOS uses three or four. You can stack as many as you want in CSS by comma-separating them; this tool lets you build that stack visually and rearrange the order. The first layer in the list is closest to the box; layers below are drawn behind.

Why does my shadow look chunky with high alpha values?

Because the shadow is a solid color drawn at full opacity. Real shadows are translucent — sunlight makes shadows around 30–40% black, ambient indoor light around 10–20%. For natural-looking shadows, drop alpha to 0.1–0.25 and increase blur to compensate. The combination of low alpha and high blur produces the look most modern design systems aim for.

What is the difference between blur and spread?

Blur softens the edges. Spread changes the size of the shadow before it is blurred. Use blur to control how diffuse the shadow looks; use spread when you want the shadow to extend beyond (positive) or contract within (negative) the box. Most natural-looking shadows use blur > 0 and spread = 0 or slightly negative.

Does the inset shadow respect padding?

No — `inset` casts the shadow on the *inside* of the box's content area, ignoring padding. To get a shadow that sits inside the padding, you would need a parent + child layout. For the typical 'sunken input field' look, inset on the input itself works fine.

Is the output safe to paste into any framework?

Yes. The generated `box-shadow: …;` declaration is plain CSS and works identically in vanilla CSS, Tailwind arbitrary values (`shadow-[...]`), styled-components, Emotion, CSS modules, and inline styles. The `box-shadow` property has been universally supported since IE9.

Is anything sent to a server?

No. The slider values, the CSS string assembly, and the preview rendering are all in-browser. No network requests during interaction.