CSS Box Shadow Generator

Create stunning drop shadows and elevation effects with real-time preview and professional presets

Controls

Adjust the settings to customize your CSS

Shadow Layers

A
Layer 1
X: 0px, Y: 4px, Blur: 6px, Spread: -1px, Opacity: 10%

Active Shadow Controls

Edit the selected shadow layer

0px
4px
6px
-1px
10%

Live Preview

See your changes in real-time

Box Shadow Preview

Presets

Choose from pre-designed effects or start with a template

Generated Code

Copy the CSS or Tailwind classes to use in your project

box-shadow: 0px 4px 6px -1px rgba(0, 0, 0, 0.1);

What is CSS Box Shadow?

The CSS box-shadow property adds shadow effects around an element's frame. Unlike text shadows, box shadows create depth for entire containers, cards, buttons, and other UI elements.

Essential for modern UI design, creating visual hierarchy, depth perception, and professional-looking interfaces that follow design systems like Material Design.

Subtle
Medium
Large
Inset

CSS Box Shadow Syntax

box-shadow: [inset] offset-x offset-y blur-radius spread-radius color;
/* Example */
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);

Required Parameters

offset-x

Horizontal distance

offset-y

Vertical distance

Optional Parameters

blur-radius

Shadow blur effect

spread-radius

Shadow size adjustment

Special Parameters

color

Shadow color

inset

Inner shadow effect

Popular Use Cases

Card Elevation

Create depth for content cards and panels in modern interfaces

Button States

Different shadows for normal, hover, and active button interactions

Modal Overlays

Strong shadows to separate dialogs and modals from background

Focus Indicators

Colored shadows to indicate focused form elements and accessibility

Advanced Techniques

1 Multiple Box Shadows

Combine multiple shadows for realistic lighting effects:

box-shadow:
  0 1px 3px rgba(0,0,0,0.12), /* Ambient shadow */
  0 1px 2px rgba(0,0,0,0.24); /* Direct shadow */

2 Neumorphism Effect

Soft UI design with dual light and dark shadows:

box-shadow:
  8px 8px 16px #bebebe, /* Dark shadow */
  -8px -8px 16px #ffffff; /* Light shadow */

Best Practices

Do This

  • Use subtle shadows for depth without distraction
  • Follow Material Design elevation principles
  • Test shadows in high contrast mode
  • Use transitions for smooth hover effects

Avoid This

  • Animating box-shadow frequently for performance
  • Using too many multiple shadows
  • Relying solely on shadows for information
  • Creating shadows that reduce accessibility

Explore Related Tools

Frequently Asked Questions

? What's the difference between blur and spread?

Blur creates the softness of the shadow edge, while spread makes the shadow larger or smaller than the original element. Positive spread expands the shadow, negative values shrink it.

? Can I use negative values for box shadows?

Yes! Negative offset values move shadows in opposite directions, and negative spread values make shadows smaller than the element. This is useful for creating unique lighting effects.

? How do I create realistic box shadows?

Use multiple shadows with different blur and opacity values to simulate real-world lighting. Combine ambient (soft, large) and direct (sharp, small) shadows for the most realistic effects.

? Do box shadows affect page layout?

No, box shadows don't affect the document flow or element positioning. They're purely visual effects that don't take up space in the layout, making them perfect for hover states.