CSS Box Shadow Generator

Build single or multi-layer CSS box shadows with visual controls. Adjust offset, blur, spread, color, opacity, and inset—then copy the CSS.

1
Layer
Preview
Live

Shadow Layers

Add multiple shadows for depth.

Layer 1
4px
4px
16px
0px
0.25

Relevant tools

Browse all →

Related design and CSS tools.

How to use the CSS box shadow generator

Start by adjusting the shadow controls for Layer 1. The X offset moves the shadow horizontally (positive = right, negative = left), and the Y offset moves it vertically (positive = down, negative = up). Blur controls how soft the shadow edge is—higher values create a more diffused, gradual shadow. Spread expands (positive) or contracts (negative) the shadow relative to the element's size.

Use the color picker and opacity slider to control the shadow color and transparency. Most modern designs use low-opacity shadows (0.05–0.25) for subtle depth rather than heavy, opaque shadows. Toggle the "Inset" checkbox to make the shadow appear inside the element instead of outside. This is useful for pressed button states, input fields, and recessed containers.

Click "Add layer" to create multi-shadow effects. Layering multiple shadows with different offsets, blur values, and colors creates more natural, realistic depth. The preview updates in real time so you can see exactly how your shadow looks. Adjust the background color, box color, and border radius to simulate your actual UI context. When you're satisfied, click "Copy CSS" to copy the complete box-shadow property to your clipboard.

Shadow design patterns

Material Design shadows use multiple layers with increasing offset and blur to simulate light source elevation. A typical card shadow might combine a sharp, close shadow (0 1px 3px rgba(0,0,0,0.12)) with a softer, wider shadow (0 1px 2px rgba(0,0,0,0.24)). This two-layer approach creates more convincing depth than a single shadow. Higher elevation levels increase the Y offset and blur proportionally.

Neumorphism (soft UI) uses paired shadows: one light shadow offset toward the light source and one dark shadow offset away from it. The background, element, and shadow colors must be carefully matched—typically the element color matches the background, with shadows being slightly lighter and darker variants. This creates a soft, extruded look but requires careful contrast management for accessibility.

For modern web design, consider using colored shadows that match or complement the element's content. A blue button with a subtle blue shadow (e.g., 0 4px 14px rgba(59, 130, 246, 0.3)) looks more cohesive than a generic gray shadow. This technique works especially well with vibrant UI elements, cards with colored borders, and call-to-action buttons where the shadow reinforces the brand color.

Performance and accessibility tips

Box shadows are rendered efficiently by modern browsers using GPU acceleration. However, animating the box-shadow property directly forces the browser to repaint on every frame. For smooth hover transitions, a better approach is to use a pseudo-element (::after) with the target shadow, set its opacity to 0, and transition the opacity on hover. This way the shadow is pre-rendered and only the opacity compositing changes during animation.

Large blur values on many elements can impact rendering performance, especially on mobile devices and during scrolling. If you notice jank, reduce blur values or limit the number of shadow layers. The filter: drop-shadow() alternative renders differently (follows the element's alpha channel rather than its box) and can sometimes be more performant for simple shadows, but doesn't support spread or inset.

Shadows contribute to visual hierarchy and readability. Elevated elements with shadows should contain more important content. Avoid using shadows purely for decoration—they should communicate depth relationships that help users understand the interface structure. Ensure sufficient contrast between shadowed elements and their backgrounds so that users with low vision can perceive the boundaries clearly.

Frequently Asked Questions

What is CSS box-shadow?

The CSS box-shadow property adds shadow effects around an element's frame. It accepts horizontal offset, vertical offset, blur radius, spread radius, and color values. Multiple shadows can be layered using comma separation. Box shadows are widely supported across all modern browsers and are one of the most common ways to add depth and elevation to UI elements.

What does spread do in box-shadow?

The spread value expands or contracts the shadow. A positive spread makes the shadow larger than the element in all directions. A negative spread makes it smaller. Spread is useful for creating tight, focused shadows (negative spread with large blur) or solid borders that don't affect layout (positive spread with zero blur). It's the fourth numeric value in the box-shadow shorthand.

What is an inset shadow?

Adding the 'inset' keyword makes the shadow appear inside the element instead of outside. Inset shadows create a recessed or pressed-in effect, commonly used for input fields, buttons in pressed states, and containers that need to appear sunken. You can combine inset and outset shadows on the same element for complex depth effects.

How do multiple shadows work?

Multiple box shadows are separated by commas. They render in stack order: the first shadow in the list is on top, and subsequent shadows render behind it. Layering multiple subtle shadows with different offsets and blur values creates more natural, realistic depth than a single heavy shadow. This technique is common in modern Material Design and neumorphism styles.

Does box-shadow affect layout?

No. Box shadows are purely visual and do not affect element sizing or document flow. They can extend beyond the element's boundary without causing overflow scrollbars (unless the parent has overflow: hidden). This makes them safe to use for hover effects and animations without causing layout shifts or reflows.

Are box shadows performant?

Box shadows are hardware-accelerated in modern browsers and are generally performant for static elements. However, animating box-shadow directly can cause repaints. For smooth animations, consider transitioning opacity on a pseudo-element with a fixed shadow instead. Large blur values on many elements can also impact scroll performance on lower-end devices.

Privacy and methodology

This tool runs entirely in your browser. Shadow values are computed using standard CSS box-shadow syntax with rgba() color notation for opacity control. The live preview renders using inline styles. No data is sent to any server. The generated CSS is compatible with all modern browsers including Chrome, Firefox, Safari, and Edge.

Tool Vault — CSS Box Shadow Generator 2026. Fast, private, and mobile-friendly.