Skip to content

Free tool

Box Shadow Generator

Design CSS box shadows visually. Adjust offset, blur, spread, and color. Layer multiple shadows, try presets, and copy the CSS code.

Shadow Layers
Inset
Generated CSS
box-shadow: 5px 5px 10px 0px #00000040;

Preset Shadows

What Is CSS Box Shadow?

The CSS box-shadow property adds shadow effects around an element. Shadows can be placed outside the element to create depth and elevation, or inside (using the inset keyword) to create pressed or embossed effects. Multiple shadows can be combined in a single declaration for layered, realistic results.

Box shadows are one of the most widely used CSS properties for creating visual hierarchy. Cards, buttons, modals, dropdowns, and navigation bars all benefit from well-crafted shadows that guide the user's eye and communicate depth.

Box Shadow Syntax Explained

The box-shadow property accepts the following values in order:

box-shadow: [inset] <x-offset> <y-offset> <blur> <spread> <color>;

  • X-offset: Horizontal displacement. Positive values push the shadow right; negative values push it left.
  • Y-offset: Vertical displacement. Positive values push the shadow down; negative values push it up.
  • Blur radius: How much the shadow is blurred. A value of 0 creates a sharp shadow. Larger values create softer, more diffused shadows.
  • Spread radius: Expands or contracts the shadow. Positive values make the shadow larger; negative values make it smaller than the element.
  • Color: The shadow color, typically a semi-transparent black (e.g., rgba(0, 0, 0, 0.15)). Using transparency allows the background to show through for a natural look.
  • Inset: Optional keyword that places the shadow inside the element instead of outside.

Creative Box Shadow Techniques

  1. Layer multiple shadows for realism. Instead of one heavy shadow, use 2 to 3 subtle shadows at different distances. This mimics how light behaves in the real world and creates a more polished look.
  2. Use colored shadows for branding. Replace generic black shadows with tinted versions of your brand color at low opacity. A blue card with a subtle blue shadow feels more cohesive than one with a gray shadow.
  3. Animate shadows on hover. Increase the blur and vertical offset on hover to create a lifting effect. Use CSS transitions for smooth animation. Keep the transition duration short (150 to 200ms) for responsiveness.
  4. Combine inset and outset shadows. Adding both an inner and outer shadow to elements like buttons creates a 3D, tactile feel that encourages interaction.

Frequently asked questions

The box-shadow property adds one or more shadow effects to an element. Each shadow is defined by horizontal and vertical offsets, blur radius, spread radius, color, and an optional inset keyword. Shadows do not affect layout; they are purely visual and render outside (or inside, if inset) the element.

More free tools