🎨 Box Shadow Generator

Create Beautiful CSS Box Shadows with Live Preview

Box Shadow

Shadow Presets

CSS Code

About Box Shadow Generator

The CSS box-shadow property adds shadow effects around an element's frame. This visual generator helps you create beautiful, customized shadows by adjusting properties like offset, blur, spread, and color, with instant preview and ready-to-use CSS code.

Visual Controls

Adjust shadow properties with intuitive sliders and live preview

Multiple Shadows

Layer multiple shadows for complex depth effects

Inset Shadows

Create inner shadows for pressed or recessed effects

Preset Library

Choose from professionally designed shadow presets

What is CSS Box Shadow?

The box-shadow CSS property adds one or more shadow effects to an element. Shadows can be applied to the outside (drop shadow) or inside (inset) of an element, creating depth and visual hierarchy in your designs. Box shadows are widely used in modern web design to create material design effects, card layouts, and button interactions.

Box Shadow Syntax

The box-shadow property accepts multiple values: box-shadow: [inset] [horizontal] [vertical] [blur] [spread] [color];

  • inset (optional): Changes shadow from outer to inner
  • horizontal offset: Horizontal distance (positive = right, negative = left)
  • vertical offset: Vertical distance (positive = down, negative = up)
  • blur radius (optional): Higher values create more blur (0 = sharp shadow)
  • spread radius (optional): Positive values expand, negative values shrink
  • color: Shadow color (any valid CSS color value)

Common Use Cases

  • Cards and Panels: Add depth to card layouts and content containers
  • Buttons: Create hover and active states with dynamic shadows
  • Images: Enhance photos and illustrations with subtle shadows
  • Modals and Dialogs: Separate overlays from background content
  • Navigation: Add depth to headers, menus, and navigation bars
  • Forms: Highlight focused input fields with shadow effects
  • Tooltips: Make floating elements appear above content

How to Use This Tool

  1. Adjust the horizontal and vertical offset sliders to position your shadow
  2. Increase blur radius for softer, more diffused shadows
  3. Use spread radius to make shadows larger or smaller
  4. Select a shadow color and adjust opacity for the desired effect
  5. Enable "Inset" for inner shadows
  6. Add multiple shadows by clicking "Add Shadow"
  7. Try preset shadows for quick professional results
  8. Copy the generated CSS code to your project

Understanding Shadow Properties

  • Horizontal Offset: Moves shadow left (negative) or right (positive). 0 centers it horizontally
  • Vertical Offset: Moves shadow up (negative) or down (positive). 0 centers it vertically
  • Blur Radius: Controls how blurry the shadow appears. 0 = sharp edge, higher = softer fade
  • Spread Radius: Expands (positive) or contracts (negative) the shadow size before blurring
  • Opacity: Controls shadow transparency. Lower values make shadows more subtle
  • Inset: Draws shadow inside the element instead of outside

Multiple Shadow Layers

You can apply multiple shadows to a single element by separating them with commas. This technique is useful for creating complex lighting effects, layered depth, or simulating realistic materials. Shadows are layered from first (top) to last (bottom) in the declaration.

Design Best Practices

  • Use subtle shadows for a clean, modern look (low opacity, small offset)
  • Maintain consistent shadow direction across your design (usually top-left light source)
  • Match shadow intensity to element importance (prominent elements = stronger shadows)
  • Avoid harsh, dark shadows unless creating dramatic effects
  • Consider using slightly colored shadows instead of pure black for warmth
  • Increase shadow size and blur on hover for interactive feedback
  • Test shadows on different background colors for visibility

Material Design Elevation

Google's Material Design uses elevation levels (1-24) to create consistent depth through shadows. Higher elevation numbers indicate elements that are "closer" to the user, with larger, softer shadows. This tool's presets include common Material Design shadow values.

Performance Considerations

  • Box shadows are GPU-accelerated in modern browsers
  • Avoid animating shadows directly; use opacity or transform instead
  • Complex shadows with large blur radii can impact rendering performance
  • Multiple shadows increase rendering cost; use judiciously
  • Consider using pseudo-elements for static shadows in performance-critical areas

Browser Support

The box-shadow property is supported in all modern browsers including Chrome, Firefox, Safari, Edge, and Opera. For older browsers (IE8 and below), shadows simply won't appear, which is typically acceptable as a progressive enhancement.

Common Shadow Patterns

  • Subtle Card: 0 2px 4px rgba(0,0,0,0.1)
  • Raised Button: 0 4px 6px rgba(0,0,0,0.15)
  • Floating Card: 0 10px 30px rgba(0,0,0,0.2)
  • Pressed Button: inset 0 2px 4px rgba(0,0,0,0.2)
  • Glow Effect: 0 0 20px rgba(color, 0.5)
  • Neumorphism: Multiple shadows (light and dark) for 3D effect

Accessibility Notes

While shadows improve visual design, ensure they don't rely solely on conveying meaning. Users with low vision or using high contrast modes may not see shadows. Always combine shadows with other visual cues like borders or color changes when indicating interactive states.

Advanced Techniques

  • Combine box-shadow with border-radius for rounded shadows
  • Use transform: translateY() with shadows for smooth hover effects
  • Layer light and dark shadows for neumorphic design
  • Apply shadows to ::before or ::after pseudo-elements for creative effects
  • Use CSS variables for consistent shadow values across your site
;