CSS Box Shadow Generator – Create & Copy CSS Online
CSS Box Shadow Generator
Create layered CSS box shadows, adjust blur and opacity, and copy the code for your website.
Shadow settings
Adjust your shadow and see the result instantly.
Shadow layers
1 / 5Live preview
CSS output
box-shadow: 0px 8px 24px 0px rgba(13, 31, 36, 0.18);
Copy the declaration into the CSS rule for your element. Multiple shadows are separated by commas.
Box Shadow Properties Explained: Offsets, Blur, Spread and Layers
A CSS box shadow generator makes it easier to create realistic depth, subtle elevation, and inset effects without repeatedly editing CSS by hand. Adjust the offset, blur, spread, color, and opacity, preview your changes, combine multiple shadow layers, and copy the resulting CSS into your website.
How to Create a CSS Box Shadow
Use the generator to build a shadow visually, then copy the CSS declaration into the rule for the element you want to style.
- 1 Choose a starting style Select a preset such as Soft, Floating, Crisp, or Inset to begin with a useful combination of settings.
- 2 Adjust the shadow Change horizontal and vertical offset, blur radius, spread radius, color, and opacity until the shadow suits your design.
- 3 Preview and refine Compare the effect against different preview backgrounds. Add more layers when a single shadow is not enough.
- 4 Copy the CSS Copy the generated box-shadow declaration and place it inside the CSS rule for your button, card, image, or other element.
Three Common CSS Shadow Styles
Different shadow styles communicate different levels of depth. A soft shadow can suggest elevation, a crisp shadow creates a more defined edge, and an inset shadow makes an element appear recessed.
| Example | CSS |
|---|---|
| Soft shadow | box-shadow: 0 4px 16px 0 rgba(13, 31, 36, 0.12); |
| Crisp shadow | box-shadow: 0 2px 4px 0 rgba(13, 31, 36, 0.25); |
| Inset shadow | box-shadow: inset 0 2px 8px 0 rgba(13, 31, 36, 0.18); |
What Each Box Shadow Property Does
A standard CSS box shadow uses horizontal and vertical offsets, followed by optional blur and spread values and a color. The inset keyword changes the shadow from an outer shadow to an inner one.
| Property | What it controls | Practical guidance |
|---|---|---|
| Horizontal offset | Moves the shadow left or right. | Positive values move it right; negative values move it left. |
| Vertical offset | Moves the shadow up or down. | Positive values move it down; negative values move it up. |
| Blur radius | Controls how soft the shadow edge appears. | Use a small value for a sharper edge and a larger value for a softer shadow. |
| Spread radius | Expands or shrinks the shadow before blur is applied. | Positive values expand it; negative values shrink it. |
| Color and opacity | Control the shadow's hue and transparency. | Lower opacity often creates a more subtle effect. |
| Inset | Places the shadow inside the element. | Useful for recessed surfaces and pressed-in interface effects. |
How to Combine Multiple Box Shadows
CSS lets you apply more than one shadow to the same element. Separate each shadow with a comma. This can combine a broad, subtle shadow with a smaller, sharper one for a more layered appearance.
For example, this declaration combines two outer shadows:
The first shadow is listed first and appears above subsequent shadows in the painting order. Adjust both layers to preserve a natural sense of depth.
In the Clicktoolset generator, you can add and edit up to five shadow layers independently. Each layer has its own offset, blur, spread, color, opacity, and inset setting. The preview and CSS output update as you make changes.
Tips for Better-Looking UI Shadows
- Start subtle: A low-opacity shadow is often more natural than a dark, sharply defined one on a light interface.
- Match the direction: Use consistent offsets for components that appear to share the same light source.
- Choose blur carefully: Larger blur values generally make the transition softer, while crisp shadows work better for more defined edges.
- Check the background: A shadow that looks clear on white may be too weak on a dark surface. Test it against the background where the element will actually appear.
- Keep layers purposeful: Multiple shadows can add depth, but unnecessary layers may make an interface look heavy.
Frequently asked questions
How do you create a box shadow in CSS?
box-shadow property with horizontal and vertical offsets, followed by optional blur and spread radii and a color. For example, box-shadow: 0 4px 16px rgba(13, 31, 36, 0.12); creates a downward, blurred shadow. You can adjust the values in the generator and copy the resulting CSS.What is the difference between blur and spread?
How do I create an inset box shadow?
inset keyword to the box-shadow declaration, such as box-shadow: inset 0 2px 8px rgba(13, 31, 36, 0.18);. This places the shadow inside the element rather than outside it.Can an element have multiple box shadows?
box-shadow declaration. Multiple layers can combine different offsets, blur values, spread values, and colors. The generator lets you create and edit up to five layers.