Box Shadow Generator (CSS)
Generate CSS box shadows with live preview. Copy the code for your project.
Shadow Layers
Preview
How to Use This Tool
Adjust shadow sliders
offset X, offset Y, blur, spread.
Pick a shadow color using the color picker.
Pick a shadow color using the color picker.
Pro Tip
Layer two shadows — a tight, dark, low-blur one plus a soft, light, high-blur one — instead of relying on a single shadow declaration. Real-world elevation in design systems like Material Design uses exactly this two-layer technique, and it reads as noticeably more realistic and grounded than any single box-shadow value can achieve on its own, no matter how carefully tuned. Keeping the shadow's color as a very dark, low-saturation tint of the page background rather than pure black also tends to look more natural, since true black shadows can appear artificially harsh against a colored backdrop. It's also worth remembering that box-shadow doesn't affect an element's layout footprint the way a border or outline would — a large shadow can visually overlap a neighboring element without pushing it aside, so leave enough surrounding margin or padding when a card's shadow needs to extend well beyond its own edges. Setting overflow: hidden on a parent container will silently clip a shadow that extends past that container's boundary, a common and confusing cause of a shadow that looks correct in isolation but disappears once placed inside a real layout.
About This Tool
When to Use
- Designing a card component's resting and hover elevation shadows for a consistent, reusable depth system across a UI
- Creating a soft drop shadow around a modal or dropdown menu to visually separate it clearly from the page content behind it
- Building a layered, multi-shadow effect for a more realistic material-design-style elevation look on key surfaces
Key Details
A CSS box-shadow generator builds single or layered box-shadow declarations with a live preview, letting you drag sliders for horizontal/vertical offset, blur radius, spread, color, and opacity, plus ...
Worked example
Setting horizontal offset 0px, vertical offset 4px, blur 12px, spread -2px, and color rgba(0,0,0,0.15) generates box-shadow: 0px 4px 12px -2px rgba(0,0,0,0.15); — a soft, slightly-lifted shadow typical of a resting-state card, copyable directly into a CSS class or a styled-component definition without any further hand-tuning needed. Bumping the vertical offset to 8px and the blur to 24px while keeping the same low opacity instead produces a noticeably more elevated hover-state shadow, useful for indicating that a card has become interactive. Adding a second, tighter shadow layer with a 2px blur and higher opacity underneath the main one further sharpens the card's edge definition without needing to touch its actual border property.
Box Shadow Generator (CSS) FAQ
What is CSS box-shadow?
box-shadow is a CSS property that adds shadow effects to elements. It can create depth, elevation, and visual hierarchy in UI design. The shadow is defined by: offset X (horizontal position), offset Y (vertical position), blur radius, spread radius, color, and optional inset keyword.
How do I create multiple shadows?
Multiple shadows are created by adding more shadow layers, separated by commas. Each layer has its own position, blur, and color. This is useful for creating realistic shadows with multiple light sources or complex effects like neon glows.
What is the difference between box-shadow and drop-shadow?
box-shadow is a CSS property that creates shadows around an element's bounding box. drop-shadow() is a CSS filter function that creates shadows that follow the element's actual shape (respecting transparency and border-radius). box-shadow is simpler and more performant for rectangular elements.
How do I create a realistic shadow?
Realistic shadows typically have: a small offset (Y: 2-10px), a blur radius about 2-3x the offset, and a semi-transparent black/color (rgba with 0.1-0.3 opacity). For material design shadows, use multiple layers: a small, sharp shadow near the element and a larger, softer shadow further away.
What CSS properties can I use the generated CSS with?
The generated box-shadow can be used on any visible HTML element that 'appears' in the CSS rendering — not just boxes. Apply it to div, section, button, card, image, or any block/inline-block element. The basic syntax is: element { box-shadow: ... }
Why does my box-shadow look blurry or pixelated?
Large blur radius values (40px+) render softly by design. If the shadow looks pixelated, it's usually because the element has a very small size and the shadow extends beyond the parent's overflow boundary. Use clip-path or overflow: visible on the parent container. Also note that shadows don't affect layout — they can overlap adjacent elements, which is expected behavior.
Master Your Entire Toolkit
Access 500+ specialized calculators and tools designed for precision. No sign-up required, 100% free.
Built and reviewed by the Toolzip Team · Based on MDN Web Docs — Box Shadow