Back to public tools
All tools

CSS Box Shadow Generator

Give a card or button a shadow. Adjust where it falls and how soft it looks, then copy the CSS box-shadow.

Edit up to six layers in each base and hover state. The preview and CSS update automatically when both stacks are valid. The first shadow is in front.

Changing units converts the lengths using this root size. Rem CSS follows the consuming page’s root size; these previews use your 8–64 px assumption without changing the tool’s own text.

Offsets and spread: ±200 px equivalent; blur: 0–200 px equivalent; opacity: 0–100%. Values serialize to six decimal places.

Paste an existing box-shadow

Paste a value or one declaration, without selectors or !important. Supports up to six layers, px/rem lengths, unitless zero, inset, hex/RGB/HSL and basic named colors. Resolve var(), calc() and other units first. Omitted color/currentColor uses the chosen assumption. Colors normalize to editable 8-bit RGB.

Preview only — included in project files, not CSS/tokens

Light / dark and base / hover comparison

The same two shadow stacks are shown on light and dark surfaces. Hover or focus a base card to switch it to the hover shadow. Scroll each preview to inspect extreme shadows.

Light surface · base / interactive hover

Light surface · hover target

Dark surface · base / interactive hover

Dark surface · hover target

Design tokens, Tailwind and CSS properties

Token JSON uses structured shadow values, including sRGB color/alpha, unit-bearing dimensions and inset. The Tailwind classes use literal arbitrary values for base and hover; include them in your framework’s source files so it can build them. Preview-only settings are excluded.

Generate an elevation scale

Generate numbered multiples of the base stack’s offsets, blur and spread. Opacity and color stay the same. These are design starting points, not a standard or a perceptual-depth guarantee.

Generated base-state elevation scale
TokenMultiplierCSS value
shadow-card-10.50px 4px 12px 0px rgba(0, 0, 0, 0.2)
shadow-card-210px 8px 24px 0px rgba(0, 0, 0, 0.2)
shadow-card-31.50px 12px 36px 0px rgba(0, 0, 0, 0.2)
shadow-card-420px 16px 48px 0px rgba(0, 0, 0, 0.2)
shadow-card-52.50px 20px 60px 0px rgba(0, 0, 0, 0.2)
Portable shadow project

Project JSON retains both layer stacks, unit/root assumption, token name, preview colors/dimensions and elevation settings. It is separate from the design-token interchange file. Import checks the complete project before replacing this workspace; nothing is saved automatically.

How to use the CSS box shadow generator

Edit two states

Choose Base or Hover, select a layer and change its offsets, blur, spread, color, opacity or inset setting. Add, duplicate, delete or reorder up to six layers per state; the first is in front. Both stacks must be valid before shadow exports update. Invalid edits retain the last valid preview and CSS.

Import or start from a preset

Paste a value or one box-shadow declaration and apply it to the selected state. Supported literal lengths are px/rem and unitless zero; colors include hex, RGB/HSL and basic names. Resolve variables, calculations, other units and !important first. Omitted/currentColor uses the chosen assumption. Imported colors normalize to 8-bit RGB. Named presets replace both states, while Copy base to hover starts a matching hover design.

Compare and convert

Changing px/rem converts current lengths using your assumed root font size. Exported rem lengths follow the consuming page’s root; previews calculate pixels from your assumption. Compare the same two stacks on light/dark surfaces. Hover or focus a base preview card to try the hover stack. Scroll each preview for extreme shadows. Preview surface colors, size and corners are stored in project files but excluded from CSS and tokens.

Export and recover

Copy or download complete base/hover CSS. Additional outputs include literal Tailwind arbitrary-value classes, named CSS custom properties and structured DTCG 2025.10 shadow tokens. Generate numbered elevation multiples from the base stack and download CSS or tokens. Token names use lowercase letters, digits and hyphens.

Portable shadow project JSON retains both stacks, units/root assumption, token name, preview options and elevation settings. Import validates the whole file before replacing the workspace. Reset restores defaults and Clear layers empties both stacks; Undo/Redo restore up to 20 editing snapshots. Settings are not saved automatically and clear on reload.

Example: a card that lifts on hover

The starting base shadow uses 0 horizontal offset, 8 vertical offset, 24 blur and 20% black. The hover state uses 12 vertical offset, 32 blur and 25% black. Hover or focus the base card to compare them on both surfaces.

Choose rem with a 16 px root assumption. The base vertical offset becomes 0.5rem and blur 1.5rem, keeping the preview the same. An elevation step of 0.5 generates half-size, original-size, one-and-a-half-size and larger base-shadow lengths. Copy the CSS or export tokens when ready.

About box shadows

A box shadow adds depth around a rectangular element. Positive horizontal and vertical offsets move right and down. Blur softens edges; spread expands or contracts them. Inset draws inside the box. Layer order matters: the first listed shadow is in front.

Shadows trace the element’s box rather than an image’s transparent outline. Light and dark preview surfaces can make the same shadow appear different; this tool does not automatically recolor it. Elevation scales multiply lengths and are design starting points, not a standard or a guarantee of perceived depth.

Lengths are bounded to about ±200 px equivalent, blur to 0–200 and opacity to 0–100%, with six-decimal serialization. Projects are limited to 256 KiB. Inputs and generated files stay in this tab, with no uploads or saved workspace. Frameworks and design tools may have their own token/import conventions; inspect the generated output in your project.

Stars and feedback

Loading…

Tool reference #113