Box Shadow Generator
This free, browser-based box shadow generator lets you build CSS box-shadow values with a live preview. Drag sliders for offset, blur, spread, and color, toggle inset, stack multiple layered shadows for realistic depth, and copy production-ready CSS or HTML in one click. Everything runs locally in your browser — nothing is uploaded, no signup is required, and your work stays completely private.
Pick a design to load a starting point — tweak sliders, remove layers with ×, or enable Use active layer only to preview one shadow at a time.
Adjust sliders for the active layer, click Add new + to stack more shadows, or pick from the gallery.
How to use the box shadow generator
- Start from a blank shadow or pick a preset from the visual effect gallery to get a sensible baseline.
- Drag the offset-x and offset-y sliders to set the direction the shadow falls.
- Adjust blur-radius for softness and spread-radius to grow or shrink the shadow’s footprint.
- Open the color control to set the shadow color and alpha — semi-transparent black or a tinted hue usually reads best.
- Toggle inset if you want the shadow painted inside the element instead of behind it.
- Click Add layer to stack a second or third shadow for more realistic, multi-step depth.
- Watch the live preview update as you tweak values, then copy the generated CSS or HTML and paste it into your project.
Anatomy of the CSS box-shadow property
The box-shadow property accepts up to four length values, an optional color, and an optional inset keyword. The order matters: the first two lengths are always the horizontal and vertical offset, the third is blur, and the fourth is spread. A typical drop shadow looks like this:
box-shadow: 0 4px 12px 0 rgba(0, 0, 0, 0.15);
Read left to right, that means: no horizontal offset, push the shadow 4px down, blur it by 12px, no spread, in black at 15% opacity. Add the inset keyword to the front and the same values describe an inner shadow instead. Because the syntax is positional, this generator writes the values in the correct order for you, so you never have to memorize which slot does what.
The box-shadow parameters explained
| Value | What it does | Typical range |
|---|---|---|
| offset-x | Horizontal distance of the shadow. Positive moves it right, negative moves it left. | -20px to 20px |
| offset-y | Vertical distance of the shadow. Positive moves it down, negative moves it up. | -20px to 20px |
| blur-radius | How soft the edge is. 0 is a hard edge; larger values feather the shadow outward. | 0px to 50px |
| spread-radius | Grows (positive) or shrinks (negative) the shadow before blur is applied. | -10px to 20px |
| color | The shadow color, usually with alpha so it blends with the background. | rgba black 8%-30% |
| inset | Keyword that paints the shadow inside the element instead of behind it. | on / off |
Layering multiple shadows for realistic depth
Real objects don’t cast a single flat shadow, and neither should your UI. You can pass a comma-separated list to box-shadow and the browser stacks them, with the first shadow drawn on top. The classic “material” elevation trick combines a tight, darker shadow for contact with a wider, lighter shadow for ambient diffusion:
box-shadow: 0 1px 2px rgba(0,0,0,0.2), 0 4px 12px rgba(0,0,0,0.1);
Each added layer compounds repaint work, so two or three well-chosen shadows almost always look better and perform better than five. This box shadow generator lets you add, reorder, and remove layers visually, then exports the entire stack as one valid declaration.
Inset shadows and inner-glow use cases
An inset shadow renders inside the border box, which makes it ideal for pressed buttons, sunken input fields, scroll-edge fades, and faux-bevel effects. Pair a light inset shadow at the top with a darker one at the bottom to fake a recessed well, or use a colored inset shadow with zero offset to create an inner glow for focus states. Because inset and outset shadows can be mixed in the same comma-separated list, you can combine an outer drop shadow with an inner highlight on a single element.
Performance and accessibility
Shadows are a paint operation, and very large blur-radius values over big elements are expensive to repaint — noticeable if the element animates or scrolls. When a shadow only needs to define an edge or a divider, a border or outline is cheaper and crisper. Reserve box-shadow for genuine elevation and depth. On accessibility, remember that a shadow is decorative: never rely on it alone to convey state, and make sure interactive elements keep a visible, sufficiently contrasting focus indicator rather than a faint glow that low-vision users may miss.
Copy-paste box-shadow recipes
Sometimes you don’t want to drag sliders — you just need a proven value to drop in and tweak. The recipes below cover the styles designers reach for most: Material Design elevation, soft layered “premium” depth, neumorphism, and colored glow. Paste any one into your stylesheet, then load it back into the generator above to fine-tune the offset, color, and alpha to match your brand.
| Style | Ready-made value | Best for |
|---|---|---|
| Subtle card | 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24) | Low elevation cards and list items |
| Material level 3 | 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23) | Raised menus, floating action buttons |
| Soft layered | 0 2px 4px rgba(0,0,0,0.05), 0 8px 16px rgba(0,0,0,0.08), 0 16px 32px rgba(0,0,0,0.06) | Modern, premium-feeling modals and popovers |
| Neumorphism (raised) | 9px 9px 18px #bec3c9, -9px -9px 18px #ffffff | Soft-UI buttons on a matching gray surface |
| Neumorphism (pressed) | inset 6px 6px 12px #bec3c9, inset -6px -6px 12px #ffffff | Active or toggled soft-UI controls |
| Colored glow | 0 0 0 3px rgba(59,130,246,0.45) | Focus rings and highlighted inputs |
The two Material rows show the system’s core idea: every elevation level is a tight, darker “key” shadow paired with a wider, lighter “ambient” one. Increase both offsets and blurs together to push an element higher off the page.
Frequently asked questions
What does each box-shadow value do?
In order: offset-x moves the shadow horizontally, offset-y moves it vertically, blur-radius softens the edge, spread-radius scales the shadow’s size, color sets its hue and opacity, and the optional inset keyword draws it inside the element instead of behind it.
How do I layer multiple shadows?
Separate each full shadow definition with a comma inside a single box-shadow declaration. The browser paints them front to back, with the first one on top. Add a layer in the generator for every shadow you need and it assembles the comma-separated value for you.
What does inset do?
The inset keyword paints the shadow inside the element’s box rather than outside it, producing an inner shadow or inner glow. It’s commonly used for pressed buttons, recessed input fields, and bevel effects.
What’s the difference between blur and spread?
Blur controls how soft and feathered the shadow edge is without changing its overall size much, while spread literally grows or shrinks the shadow’s shape before any blur is applied. Use spread to make a shadow bigger or tighter, and blur to make it harder or softer.
How do I make a soft, realistic shadow?
Use a small vertical offset, a generous blur, little or no spread, and a low-opacity color such as rgba(0,0,0,0.12). For extra realism, stack a tight contact shadow under a wider ambient one so the depth reads naturally instead of looking like a single flat blob.
Can you animate box-shadow performantly?
Animating box-shadow directly triggers repaints and can stutter on large or heavily blurred elements. A smoother technique is to render the shadow on a pseudo-element and animate its opacity instead, which the browser can composite on the GPU without repainting the shadow each frame.
Should I use a shadow or a border?
Use a border or outline when you only need a crisp dividing line — it’s cheaper to render and pixel-sharp. Use box-shadow when you want to communicate elevation, depth, or focus. They also combine well: a subtle border plus a soft shadow often looks more polished than either alone.
Is this tool free and private?
Yes. The box shadow generator runs entirely in your browser, requires no account, and never uploads your designs. All preview and export happens client-side, so your work stays completely private.
How do I create a neumorphism shadow?
Use two shadows of the same blur but opposite offsets — a dark one toward the bottom-right and a light one toward the top-left — on an element whose background matches the page exactly. For example, box-shadow: 9px 9px 18px #bec3c9, -9px -9px 18px #ffffff; gives a raised “soft UI” look. Add the inset keyword to both for a pressed state. The effect only works on a single, low-contrast background color with a consistent light source.
What are Material Design elevation shadows?
Material Design maps depth to a set of elevation levels, each defined by two stacked shadows: a sharper “key” shadow for the contact edge and a softer “ambient” shadow for diffuse light. Higher levels increase the offset and blur of both layers so the element appears to float further above the surface. The recipes above include a ready-to-use level-3 value you can scale up or down.
Why does my box-shadow get clipped by overflow:hidden?
An outer box-shadow is painted outside the element’s border box, so if an ancestor has overflow: hidden (often used to clip rounded corners), it crops the shadow too. Fix it by moving the shadow onto the clipping element itself, removing the overflow: hidden, or wrapping the element in an extra padded container that carries the shadow instead.
Can I copy the shadow as a Tailwind class or HTML?
Yes. Copy takes whatever the output box shows: a .shadow-box CSS rule on the CSS tab, or on the HTML + CSS tab a 120 × 120 px div with the background color, corner radius and shadow written inline. Copy value only copies just the box-shadow value, and Copy Tailwind copies an arbitrary-value class such as shadow-[0px_10px_20px_0px_rgba(0,_0,_0,_0.15)], with spaces turned into underscores.
Related design tools & guides
- Border Radius Generator — round corners with a live CSS preview.
- Cubic Bezier Editor — craft custom easing curves for animating shadows and more.
- Color Picker — pick and convert the perfect shadow color and alpha.
- Browse all free design tools — the full collection of browser-based generators.