Generate CSS box-shadow with sliders for X/Y offset, blur, spread, color, and opacity. Toggle inset mode and copy the ready-to-use CSS instantly.
box-shadow: 4px 4px 8px 0px rgba(0,0,0,0.25);
The CSS box-shadow property attaches one or more shadow effects to an element frame.
Well-crafted shadows establish visual hierarchy, convey elevation in design systems (such as Material Design and Human Interface Guidelines), and provide subtle depth cues without cluttering the interface.
The property accepts horizontal and vertical offsets, blur radius, spread radius, colour, and an optional inset keyword:
box-shadow: [inset] <offset-x> <offset-y> <blur-radius> <spread-radius> <color>;
| Parameter | Type | Description |
|---|---|---|
offset-x | Length (px, rem) | Positive values position shadow right; negative values move it left |
offset-y | Length (px, rem) | Positive values position shadow below; negative values move it above |
blur-radius | Length (px) | Standard Gaussian blur radius. Defaults to 0 (sharp edge) |
spread-radius | Length (px) | Positive expands shadow size; negative contracts it |
color | CSS Color | Hex, RGB, or HSL value (prefer semi-transparent alpha channels) |
inset | Keyword | Casts the shadow inside the frame instead of outside |
In the physical world, shadows are soft and diffused because light scatters across surfaces. A single harsh CSS shadow often looks artificial. Professional UI designers stack multiple complementary shadow layers:
/* Elevation Level 2: Soft Natural Ambient Shadow */
.card-elevation-2 {
box-shadow:
0 1px 3px rgba(0, 0, 0, 0.05),
0 4px 12px rgba(0, 0, 0, 0.08);
}
/* Elevation Level 4: Floating Modal / Dropdown */
.modal-elevation-4 {
box-shadow:
0 4px 6px -1px rgba(0, 0, 0, 0.06),
0 10px 24px -3px rgba(0, 0, 0, 0.12),
0 0 1px 0 rgba(0, 0, 0, 0.08);
}
transform: translateY() or animating opacity on a pseudo-element rather than transitioning box-shadow directly.rgba(255,255,255,0.08)) to indicate depth.:hover and :focus-visible states to convey interactive affordance.This website and utility are provided for general informational, calculation, and educational purposes only. Always verify critical computation outputs prior to professional deployment or financial use. See our Terms of Service and Privacy Policy for full governance details.