How to Make a CSS Box Shadow, From Hard to Soft and Natural
Updated November 2026
Written by the Toolpuffin team. Tools in this guide are tested in the browser.
A box shadow makes a card, button or image lift off the page. The syntax has four numbers that are easy to mix up. This guide explains them and shows how to make a soft, natural shadow.
Try the tool: Box Shadow Generator
What the numbers mean
A shadow is written as: horizontal offset, vertical offset, blur, spread, colour. For example: 0 4px 12px 0 rgba(0,0,0,0.15).
- Horizontal and vertical offset move the shadow right and down. Negative values move it left and up.
- Blur makes the edge softer. A larger number is softer and wider.
- Spread makes the shadow bigger or smaller in every direction before the blur. A negative spread makes it smaller than the element.
- Colour with opacity sets how strong it is. A low opacity looks more natural than solid black.
Source: MDN: box-shadow
Soft and natural
Real shadows are not one flat layer. Stack two or three: a small, sharp one close to the element and a larger, blurrier one with a low opacity. The tool lets you add up to four layers.
Build one
- Move the sliders until the preview looks right.
- Add another layer for a softer, more natural shadow.
- Copy the CSS.
Inset shadows
An inset shadow is drawn inside the element instead of behind it. It is often used for pressed buttons and input fields.
Tips
- Keep shadows subtle on a light page. A shadow that is clearly visible usually looks heavy.
- Use the same shadow style across the site so it looks consistent.
- Preview the shadow on both a light and a dark background if your site has a dark mode.