How to Use the CSS Box Shadow Generator
- Adjust the horizontal offset, vertical offset, blur radius, and spread sliders.
- Pick a shadow color and opacity, and toggle "inset" for an inner shadow.
- Watch the live preview box update in real time.
- Copy the generated `box-shadow` CSS declaration.
Understanding box-shadow values
box-shadow takes, in order: horizontal offset (positive moves the shadow right), vertical offset (positive moves it down), blur radius (higher values create a softer, more spread-out shadow), spread radius (expands or shrinks the shadow shape), and a color. An optional "inset" keyword flips the shadow to appear inside the element's border instead of outside it.
Design tips for realistic shadows
Subtle, low-opacity shadows with a moderate blur radius tend to look more natural than large, dark, sharp-edged shadows. Layering multiple shadows (a tight, dark one plus a soft, wide one) is a common technique for a more realistic sense of depth, similar to how real-world shadows have both a sharp core and a diffuse edge.
Example
Offset 0,4 · Blur 12 · Color rgba(0,0,0,.25)
box-shadow: 0px 4px 12px 0px rgba(0, 0, 0, 0.25);
Tips
- Lower opacity (10-30%) shadows generally look more realistic than fully opaque ones.
- Use "inset" for pressed-button or input-field effects rather than raised-element shadows.
Frequently Asked Questions
What does the spread value do?
Spread expands (positive values) or contracts (negative values) the size of the shadow shape itself, independent of blur.
Can I add multiple shadows to one element?
Yes, CSS box-shadow accepts a comma-separated list of shadow definitions layered on top of each other.