How to use the box shadow generator
- Start from a preset or one of the Smooth S–XL buttons.
- Select a layer and drag its offset on the pad, or focus the handle and use the arrow keys. Fine-tune with the offset, blur and spread sliders.
- Add, duplicate or reorder layers. The first layer is drawn on top.
- Turn on Inset for inner shadows, such as pressed buttons or input wells.
- Set the element and background colors so the preview matches your page, then check the edge contrast.
- Copy plain CSS, a
--shadowcustom property, SCSS or Tailwind (an arbitrary value plus a config/theme snippet for a named shadow).
Already have a shadow? Paste it into Paste an existing shadow, for example 0 4px 12px rgba(0, 0, 0, 0.2), 0 1px 2px #0000001a, and every layer becomes editable.
How it works
box-shadow takes a comma-separated list. Each item is inset? x y blur spread color:
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12), 0 8px 24px rgba(15, 23, 42, 0.12);
The first shadow in the list paints on top. Shadows never affect layout, so adding one doesn’t move neighbouring elements. They follow border-radius, and inset shadows draw inside the padding box.
Examples
- Subtle card:
0 1px 2px rgb(0 0 0 / 0.06), 0 1px 3px rgb(0 0 0 / 0.1)gives a crisp edge plus a soft spread, good for resting cards. - Raised on hover:
0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1). The negative spread keeps the shadow under the element instead of around it. - Focus ring:
0 0 0 3pxin your accent color draws an outline that follows the border radius and doesn’t change layout. - Inset field:
inset 0 1px 2px rgb(0 0 0 / 0.08)makes an input look slightly recessed. - Colored glow:
0 8px 24pxwith your brand color at about 35% opacity lifts a primary button off the page.
Choosing shadows for a design system
Use a small elevation scale (for example 1–5) and assign each level a job: cards rest at 1–2, dropdowns float at 3, dialogs sit at 5. The Elevation presets give you a consistent ladder. Colored shadows, matching a tinted element, look more natural than grey on colorful designs.
Common mistakes
- Very dark, tight shadows. Use low opacity (0.08–0.2) and more blur.
- Shadows on dark backgrounds. Black shadows disappear on dark surfaces. Use a lighter surface, a subtle border, or a colored glow instead.
- Animating box-shadow directly. Animate the opacity of a pseudo-element that carries the shadow; it’s much cheaper.
Import CSS from your site
Already have a style you like? Open Import CSS (copy from a site), paste a rule or just its declarations from your stylesheet or your browser’s developer tools, and press Import into the controls. This tool reads box-shadow (every layer, including inset), background color and border-radius. Everything else, and rules for states such as :hover or media queries, is listed as skipped, and the import can be undone in one step.