Design

CSS box-shadow generator

Tweak offset, blur, spread, color and opacity with a live preview. Stack multiple shadows, enable inset mode and copy the ready-to-paste box-shadow code for your stylesheet.

Instant🔒In your browserNo signup
Live
Presets:

What the box-shadow generator is for

The CSS box-shadow property adds one or more shadows around any HTML element and is the main tool for conveying depth and elevation in an interface. With it you build the cards that seem to float above the background, buttons with relief, modals that lift off the page and dropdown menus that rest on top of the content. A shadow blends five ingredients: how far it shifts horizontally (offset-x) and vertically (offset-y), how blurry it is (blur), how much it spreads before blurring (spread), and its color and opacity. This generator lets you move every value with sliders or type it by hand, see the result live on a checkerboard background —so you can spot transparency— and copy the box-shadow code ready to paste. You can also stack multiple layers and enable inset mode for inner shadows.

The box-shadow parameters, one by one

The syntax is box-shadow: offset-x offset-y blur spread color; (plus the optional inset keyword at the start). This table sums up what each value does, its typical range and what happens when it is negative:

ParameterWhat it doesTypical valuesIf negative
offset-xShifts the shadow horizontally.0 on cards; ±2–10px for side light.The shadow moves to the left.
offset-yShifts the shadow vertically.4–20px (simulates overhead light).The shadow rises, like light from below.
blur-radiusBlurs the edge of the shadow.0 = hard; 8–30px = soft and modern.Not allowed: it is ignored, minimum 0.
spread-radiusGrows or shrinks the shadow before the blur.0 in most cases.Contracts the shadow: smaller than the element.
colorColor and opacity (ideally rgba).Black rgba with 4–15% alpha.N/A (there is no negative color).
insetProjects the shadow inward.Pressed inputs, drop zones, neumorphism.N/A (it is a keyword, not a number).

box-shadow vs drop-shadow vs text-shadow

Three different properties make shadows in CSS and they should not be confused:

PropertyWhat it projects ontoSupports inset / spreadWhen to use it
box-shadowThe element's box (respects border-radius).Yes to both.Cards, buttons, modals, UI elevation.
filter: drop-shadow()The real pixels, including PNG/SVG transparency.No to either; runs on the GPU.Icons, cut-out images, irregular shapes.
text-shadowThe text glyphs.No (no spread or inset).Text legibility over images, headings.

The trick of stacking multiple shadows

The "premium" shadows you see on Stripe, Vercel or Linear are not a single one: they are two or three stacked layers. A short, sharp one right against the element (offset-y of 1–2px, low blur, medium opacity) and a long, diffuse one further down (offset-y of 8–24px, high blur, low opacity). That mimics real light, which casts a direct shadow and an indirect one. With the "+ add shadow" button you stack layers and the generator joins them with a comma:

box-shadow:
  0 1px 2px rgba(15, 23, 42, 0.06),
  0 8px 24px rgba(15, 23, 42, 0.10);

Inner shadows (inset) and neumorphism

The inset keyword pushes the shadow inside the element and simulates a sunken surface. Legitimate cases: pressed-state inputs, containers that look carved into the page and active drag zones. The neumorphism effect combines two shadows: a light one top-left and a dark one bottom-right, so the element seems made of the same material as the background, barely raised. Try the "Neumorphism" preset to see the pattern.

Shadows and dark mode

On dark backgrounds black shadows nearly vanish: black on black has no contrast. Three practical fixes:

  1. Light borders instead of a shadow: border: 1px solid rgba(255,255,255,0.08).
  2. More opaque shadows (20–40% instead of 8–12%) and with more blur.
  3. Colored shadows: a shadow tinted with the brand color at low opacity gives a glow effect rather than depth.

Performance: when it can break the frame rate

Unlike filter: drop-shadow(), which runs on the GPU, box-shadow is computed on the CPU. A large blur across dozens of elements, or animating the blur in real time, can hurt smoothness. If you need to animate a shadow on hover, animate transform or transition the opacity of an already-rendered shadow layer instead of recomputing the blur every frame.

FAQ

What is box-shadow?

The CSS property that paints one or more shadows around an element. It gives depth to cards, buttons, modals and menus.

How do I make several shadows?

Separate each shadow with a comma in the same property. The "+ add shadow" button stacks layers and joins the CSS for you. Stacking 2–3 gives a realistic effect.

box-shadow or filter: drop-shadow()?

box-shadow follows the element's box and supports spread and inset. drop-shadow follows the real pixels (great for PNG/SVG), runs on the GPU and supports neither spread nor inset.

What does inset do?

It projects the shadow inward, simulating a sunken surface. Useful for pressed inputs, drop zones and neumorphism.

Why use rgba?

To control opacity. Realistic shadows use 4–15% alpha; a fully opaque shadow looks harsh. The generator converts color + opacity to rgba.

Are large shadows slow?

box-shadow is computed on the CPU. A huge blur across many elements, or animating the blur, can drop the frame rate. To animate, prefer transform or opacity.

What is spread for?

It grows (positive) or shrinks (negative) the shadow before the blur. Most cards leave it at 0.

Do I need -webkit-box-shadow?

Not in modern browsers: box-shadow has universal support. The -webkit- toggle is only there if you want compatibility with very old browsers.

Was this generator useful?