CSS Box Shadow Generator

Adjust the sliders, pick a preset from the Effect Gallery, and copy your ready-to-use CSS code.

🎛️ Shadow Settings Click value to reset
Color:
👁️ Live Preview & CSS Code
Preview

What Is a CSS Box Shadow Generator?

A CSS Box Shadow Generator is a visual web design tool that lets you create drop shadows and inner (inset) shadows for HTML elements without writing code by hand. As you move sliders for offset, blur, spread, color, and opacity, the tool updates a live preview and generates ready-to-use CSS code.

Whether you are designing modern UI cards, floating buttons, glassmorphism panels, or soft 3D containers, WebToolar’s CSS Box Shadow Generator helps you build pixel-perfect shadows that work across all modern web browsers.

How to Use the WebToolar CSS Box Shadow Generator

Creating a custom CSS shadow takes less than 10 seconds:

  1. Adjust Shadow Position: Move the Shift Right (X) and Shift Down (Y) sliders to position the shadow horizontally and vertically behind your element.
  2. Set Softness & Size: Increase the Blur slider for a soft, natural glow, and adjust the Spread slider to expand or shrink the shadow size.
  3. Customize Color & Opacity: Pick a shadow color and lower the Opacity slider (usually between 0.10 and 0.35 for realistic modern UI shadows).
  4. Toggle Inset or Add Layers: Check Inset to switch from an outer drop shadow to an inner shadow, or click + Add New Layer to stack multiple shadows for deeper 3D realism.
  5. Explore the Effect Gallery: Click any preset in the 16-Style Effect Gallery (Hover, Sides, Button, Mirrors, In&Out, Gradient, Pile, Checker, Borders, Rainbow, Candy, Flames, Candle, Well, Pyramid, Target) to load it immediately.
  6. Copy Your CSS: Click Copy CSS Code to copy the standard box-shadow property (along with optional -webkit- and -moz- prefixes) into your stylesheet.

Understanding CSS Box-Shadow Syntax (Quick Reference)

In CSS, the box-shadow property follows a specific order of values:

cssbox-shadow: [inset] [horizontal-offset] [vertical-offset] [blur-radius] [spread-radius] [color];
ParameterRequired?DefaultWhat It Controls
insetOptionalOutset (Drop)Moves the shadow inside the element border instead of outside.
Horizontal Offset (x)Yes0pxPositive values push the shadow right; negative values push it left.
Vertical Offset (y)Yes0pxPositive values push the shadow down; negative values push it up.
Blur RadiusOptional0pxHigher numbers create a softer, wider blur. 0px creates a sharp edge.
Spread RadiusOptional0pxPositive values enlarge the shadow; negative values make it narrower than the box.
Color (rgba / hex)OptionalCurrent Text ColorDefines the shadow color and transparency (e.g., rgba(0, 0, 0, 0.25)).

5 Ready-to-Use Modern CSS Box Shadow Examples

You can copy these industry-standard CSS shadow values directly into your project or test them inside the generator above:

Shadow StyleBest Used ForCSS Code (box-shadow)
1. Subtle UI CardBlog cards, dashboard widgets0px 4px 12px rgba(15, 23, 42, 0.08);
2. Floating HoverInteractive buttons, pricing tables0px 10px 13px -7px rgba(0, 0, 0, 0.85);
3. Multi-Layer 3DModals, dropdown menus, popups0px 20px 25px -5px rgba(0,0,0,0.1), 0px 8px 10px -6px rgba(0,0,0,0.1);
4. Soft Inner WellForm inputs, pressed buttonsinset 0px 2px 6px 0px rgba(0, 0, 0, 0.18);
5. Brutalist Hard EdgeRetro cards, bold CTA buttons6px 6px 0px 0px #12372A;

Pro Tips for Designing Realistic UI Shadows

  • Use Negative Spread for Natural Elevation: Setting a negative spread (such as -5px or -7px) with a larger vertical offset (10px to 20px) prevents shadows from spilling out on all four sides and makes elements look naturally lifted off the page.
  • Layer Two Shadows Instead of One Heavy Shadow: Real-world light creates two shadows: a small, darker contact shadow close to the object and a larger, softer ambient shadow further away. Use the + Add New Layer button in WebToolar to combine both.
  • Avoid Pure Black at High Opacity: Instead of harsh #000000 at 80% opacity, use a dark slate or navy tint with 10% to 25% opacity (rgba(15, 23, 42, 0.15)) for a clean, modern appearance.
  • Check Contrast on Custom Backgrounds: Use the Object and Bg color pickers inside the preview box to verify how your shadow looks on both white and colored page sections.

FAQs: CSS Box Shadow Generator

1. What is the difference between box-shadow and drop-shadow() in CSS?

The box-shadow property casts a rectangular shadow around an element’s entire box frame (respecting border-radius). In contrast, filter: drop-shadow() follows the transparent alpha outline of PNG or SVG images, though only box-shadow supports the inset keyword and spread-radius.

2. How do I create an inner shadow in CSS?

To create an inner shadow, add the inset keyword at the beginning of your box-shadow rule—for example: box-shadow: inset 0px 4px 10px rgba(0, 0, 0, 0.25);. In the WebToolar generator, simply check the Inset box to switch between outer and inner shadows.

3. Can I add multiple box shadows to a single HTML element?

Yes. CSS allows you to stack unlimited shadows on a single element by separating each shadow layer with a comma. The first shadow in the list renders on top, and subsequent shadows render behind it.

4. How do I make a box shadow appear only on the bottom of an element?

Set the Shift Down (Y) slider to a positive value (such as 10px), set Blur to 13px, and set Spread to a negative value (such as -7px). The negative spread pulls the shadow inward from the left and right edges so it only appears underneath the box.

5. Do I still need -webkit-box-shadow and -moz-box-shadow prefixes?

All modern browsers (Chrome, Firefox, Safari, Edge, and mobile browsers) natively support the standard box-shadow property without vendor prefixes. However, keeping -webkit-box-shadow and -moz-box-shadow enabled ensures backward compatibility with older legacy browsers.

6. Why is my CSS box-shadow not showing up on my webpage?

A box-shadow may be hidden if the parent container has overflow: hidden; applied, which clips shadows outside the box boundary. Adding padding to the parent container or changing overflow to visible resolves the issue.

Related Tools