CSS Box Shadow Generator
Design layered shadows on real CSS components, compare light and dark contexts, import existing CSS and export reusable elevation tokens. Everything runs in your browser.
Local processing · No account required · Copy and export
Ready · choose a preset or adjust a shadow.
Drag the ✥ handle to move the selected shadow. No canvas simulation: this is live box-shadow.
Your CSS
The generated code and browser preview use the same layer list. Use the import box below to edit existing CSS.
Import CSS · Project recovery · Elevation tokens
Paste existing box-shadow
Supports px, inset, multiple layers, hex, rgb/rgba and named colors; unsupported units are rejected.
Editable project
Local draft save is opt-in; downloaded JSON is portable. No project data is uploaded.
Elevation tokens
Choose “Elevation tokens” above to generate CSS variables.
How to use CSS Box Shadow Generator
- Choose a preset or add independent shadow layers. Positive X/Y offsets move each shadow right and down.
- Edit each layer’s blur, spread, color, opacity, inset and order. Hide a layer to exclude it from the code.
- Preview a card, button or modal in light/dark mode; copy CSS, save elevation tokens, download CSS or reopen the editable JSON project.
When to use this tool
Compare elevation styles for cards, dialogs and inset controls. Copy a preset as a starting point, then check contrast and visual weight in the component itself.
Understand offsets, blur and spread
Blur softens the shadow edge and cannot be negative. Spread grows the shadow shape when positive and shrinks it when negative. The inset keyword moves the shadow inside the element's border. Multiple comma-separated shadows draw separately: the first listed shadow appears on top. Each V2 layer can be edited, reordered and hidden independently.
Worked example
box-shadow: 0px 12px 30px -8px rgba(38, 59, 73, 0.2);
/* x: 0, y: 12, blur: 30, spread: -8 */ Choose surface depth without changing the layout
- For an authored card exercise, start with Soft card and inspect offsets, blur, spread and opacity rather than assuming the preset is a finished style.
- Compare Raised panel and Inset surface for exterior/interior effects. A shadow does not add layout space around the element.
- Use Add ambient layer for a supporting shadow. It becomes a normal editable layer and can be hidden, reordered or deleted.
- Copy CSS and inspect it with the component's actual background, radius, layers and clipping containers.
A box shadow follows the element box. It does not automatically follow a transparent logo's visible silhouette.
The current editor exports genuine browser-usable CSS. Review it in the target page as well; no remote target-page scanning is performed. Use Layout Playground for spacing or CSS Clamp Calculator for a fluid property.
Limits and output checks
A box shadow follows the element's box rather than the visible alpha outline of an image. Use filter: drop-shadow() when that distinction matters. Stage backgrounds, border radii and ancestor clipping affect apparent depth. Shadows alone are not sufficient focus indicators; use an outline as well.
Reference: CSS box-shadow reference.
Frequently asked questions
What does a negative spread do?
It contracts the shadow shape before blur, which can help concentrate a shadow below a card.
Can I create an inset shadow?
Yes. Enable inset or start with the inset preset. The exported declaration includes the inset keyword.
Why does the shadow look different on my site?
Background color, element dimensions, clipping, browser rendering and surrounding layers change its appearance. Preview the CSS in the intended layout.
Can I import layered CSS and reuse it?
Yes. Open the Import CSS section, paste a box-shadow declaration with supported px offsets and colors, then edit layers individually. Save a versioned JSON project or elevation token for later reuse.
Do shadows replace focus and contrast design?
No. Forced-colors modes may suppress CSS shadows. Provide a visible outline or border and test actual text and control contrast independently.
Choose a box shadow for the actual component
Add or import layered shadows, compare them on different components and themes, then export CSS or elevation tokens. Verify the result in your destination stylesheet.
Scope of this workflow
A box shadow follows the element box, not an image’s alpha outline. The live stage offers component size and surface controls, but ancestor overflow may still clip shadows. Soft shadows are not a replacement for a visible keyboard focus outline.
CSS Clamp Calculator — Fluid Type & Spacing · All developer tools · Privacy policy · Contact PixelOkay