Skip to main content

CSS Shadow Generator

Create multi-layer box shadows with a visual editor and live preview.

How it works

  1. 1

    Choose a preset or start fresh

    Select a shadow preset like Subtle, Elevated, or Bold — or start with default values.

  2. 2

    Adjust shadow layers

    Tune X/Y offset, blur, spread, color, and opacity for each layer. Add up to 6 layers.

  3. 3

    Copy the CSS

    Copy the generated box-shadow property and paste it into your stylesheet.

Common use cases

  • Card shadow

    Subtle preset

  • Elevated panel

    Two layers: soft + sharp

About This Tool

Design box shadows visually with up to 6 stacked layers. Each layer has independent controls for X/Y offset, blur radius, spread distance, color, opacity, and inset toggle. A live preview panel shows exactly how the shadow renders against a configurable background and box color.

Start from built-in presets — Subtle (light card shadow), Medium (elevated UI), Elevated (floating panel), Bold (dramatic depth), Inset (pressed effect), and Colored (brand shadow) — or build custom shadows from scratch.

The output is a copy-ready CSS box-shadow property with proper rgba() values that respects opacity. Multi-layer shadows produce the most realistic depth effects because real-world shadows have multiple soft and sharp components.

All rendering happens in your browser — nothing is transmitted anywhere.

Understanding CSS box-shadow syntax is key to mastering UI depth. The property accepts a comma-separated list of shadows, each defined by: horizontal offset, vertical offset, blur radius, spread radius, color, and an optional inset keyword. The horizontal and vertical offsets determine the shadow direction and distance. Positive X moves the shadow right, negative left. Positive Y moves it down, negative up.

Blur radius controls how soft or sharp the shadow edge appears. A blur of 0 creates a sharp-edged shadow (rarely desirable), while larger values create a softer, more diffuse effect. Most UI shadows use blur values between 3 px and 40 px. The blur does not increase the overall shadow size — it distributes the color across the blur area.

Spread radius expands or contracts the shadow beyond the element boundaries. Positive spread makes the shadow larger than the element, while negative spread shrinks it. A common pattern uses negative spread to prevent ambient shadows from extending too far. The spread is particularly useful for creating glow effects when combined with a large blur.

Multi-layer shadow technique: The most realistic shadows combine two or more layers. A typical pattern uses a tight, dark shadow for definition (small offset, small blur) plus a larger, lighter shadow for ambient depth (larger offset, large blur). This mimics how real lighting creates both sharp and soft shadow components. Three-layer shadows add even more realism with a very subtle, very large ambient layer.

Material Design popularized the concept of elevation-based shadows, where elements at different heights in the z-axis have progressively larger and softer shadows. This approach creates a clear visual hierarchy that communicates which elements are interactive and which are static.

Inset shadows render inside the element instead of outside. They create a recessed or pressed effect and are commonly used for form inputs (to show they are interactive), wells and sunken areas, and toggle buttons in their active state. A subtle inner shadow combined with a slight background color change creates a convincing pressed effect.

Performance: Box shadows are GPU-accelerated in modern browsers and generally perform well. However, very large blur values on many elements can impact scrolling performance. For animated shadows (like hover effects), use CSS transitions on box-shadow for smooth interpolation, or better yet, use a pseudo-element with opacity transitions for better performance on complex shadows.

More examples

Examples

Card shadow

Input

Subtle preset

Output

box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.10);

Elevated panel

Input

Two layers: soft + sharp

Output

box-shadow: 0px 10px 15px -3px rgba(0,0,0,0.10), 0px 4px 6px -4px rgba(0,0,0,0.10);
Frequently Asked Questions
Why use multiple shadow layers?
Real-world shadows are a blend of soft ambient light and sharp direct light. Combining a large-blur ambient shadow with a smaller, sharper shadow creates a much more realistic depth effect than a single layer. Most professional UI designs use 2-3 shadow layers.
What is an inset shadow?
An inset shadow renders inside the element rather than outside, creating a pressed or recessed appearance. It is useful for input fields, wells, and subtle depth effects. Add the inset keyword to any shadow layer to toggle this behavior.
What values should I use for a subtle card shadow?
A common subtle shadow is: box-shadow: 0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1). This gives a gentle elevation without being overly dramatic. Tailwind CSS uses this as the default shadow-sm value.
Can I use CSS variables for shadow colors?
The generator outputs rgba() values. You can replace the color in your stylesheet with CSS custom properties for theming. For example, replace rgba(0,0,0,0.1) with var(--shadow-color) and define the variable in your theme.
What is the difference between blur and spread?
Blur controls the softness of the shadow edge — larger values create a more diffuse shadow. Spread controls the size of the shadow relative to the element — positive values make the shadow larger, negative values make it smaller. A glow effect uses high blur with positive spread.
How do I animate a shadow on hover?
Use CSS transitions: transition: box-shadow 0.3s ease. Define a lighter shadow for the default state and a more prominent shadow for the hover state. For better performance with complex shadows, use a pseudo-element with opacity transitions instead.
What are colored shadows?
Colored shadows use a tinted version of your brand or element color instead of black or gray. For example, a blue button might have a blue-tinted shadow: box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4). Colored shadows create a more cohesive, modern look.
How does the Material Design elevation system work?
Material Design assigns elevation levels (dp) to UI elements. Higher elevation means a larger, softer shadow. Level 0 is flat (no shadow), level 1 has a subtle shadow, and level 5 has a dramatic shadow. This creates a clear visual hierarchy showing which elements are above others.

Learn More

Related Guides

Discover More Tools

View all Design Tools →