CSS Box Shadow Generator

Create beautiful, layered CSS box shadows with a live preview. Stack multiple shadow layers for smooth, realistic depth effects.

Shadow Layers

Layer Settings

0px
4px
12px
0px
15%
CSS Code

How to Use the CSS Box Shadow Generator

Start by adjusting the offset, blur, spread, and colour of the default shadow layer. To create more realistic, layered shadows, click + Add Shadow Layer and stack multiple shadows together. Click any layer in the list to edit it. Use the presets above for quick starting points, then customise to match your design.

Understanding CSS Box Shadows

The box-shadow Property

The CSS box-shadow property adds one or more shadow effects to an element's frame. The basic syntax takes five values: horizontal offset, vertical offset, blur radius, spread radius, and colour. A positive horizontal offset pushes the shadow right; a positive vertical offset pushes it down. The blur radius controls how soft the edges are, and the spread radius expands or shrinks the shadow.

Layered Shadows for Realistic Depth

The secret to beautiful shadows is layering. A single shadow with a large blur looks flat and unnatural. Instead, stack two to four shadows with different sizes — a small, tight shadow for definition, a medium shadow for the main depth, and a large, subtle ambient shadow. This mimics how light behaves in the real world, where objects cast multiple shadows from different light sources.

Inset Shadows

Adding the inset keyword flips the shadow to the inside of the element. This creates a pressed, recessed, or carved effect. Inset shadows are commonly used for input fields, wells, and neumorphism design patterns. You can combine inset and outset shadows on the same element for complex effects.

Performance Considerations

Box shadows are rendered efficiently in modern browsers and have minimal impact on page performance. The main thing to avoid is animating the box-shadow property directly, as it triggers repaints on every frame. If you need animated shadows, consider transitioning opacity on a pseudo-element with a fixed shadow instead.

Related CSS Design Tools

Frequently Asked Questions

What is a CSS box shadow?
A CSS box shadow is a visual effect that adds a shadow around an HTML element. It's created with the box-shadow property and accepts values for horizontal offset, vertical offset, blur radius, spread radius, and colour. Multiple shadows can be stacked by separating them with commas.
How do I add a box shadow in CSS?
Use the box-shadow property on any element. The syntax is: box-shadow: [x] [y] [blur] [spread] [colour];. For example: box-shadow: 4px 4px 12px rgba(0,0,0,0.15); creates a subtle shadow offset down and to the right.
Can I add multiple box shadows to one element?
Yes. Separate multiple shadows with commas in a single box-shadow declaration. Layering several subtle shadows creates a much more realistic depth effect than a single heavy shadow.
What is the difference between box-shadow and drop-shadow?
box-shadow applies to the rectangular box of an element. The filter: drop-shadow() function follows the actual visible shape, including transparent areas. Use box-shadow for cards and containers; drop-shadow for irregular shapes.
What is an inset box shadow?
Adding the inset keyword places the shadow inside the element. This creates a pressed or recessed effect, useful for input fields, wells, and neumorphism designs.
How do I make smooth, layered box shadows?
Stack multiple shadows with progressively increasing blur and offset. Combine a tight shadow (1–2px blur), a medium one (6–10px), and a wide ambient one (20–40px). Each layer should be subtle on its own.
Are CSS box shadows bad for performance?
Not in general. Avoid animating box-shadow directly — animate opacity on a pseudo-element with a fixed shadow for smooth transitions instead.
Does box-shadow work in all browsers?
Yes. Fully supported in all modern browsers since roughly 2011 with no vendor prefixes needed.