Multi-layer · Neumorphism · Tailwind export

CSS Box-Shadow Generator

Build multi-layer box shadows visually with live preview. Copy plain CSS or a Tailwind arbitrary-value class instantly.

Box

              
            

Multi-layer CSS shadows and neumorphism made easy

CSS box-shadow accepts multiple comma-separated layers, which is how modern designs achieve depth. The neumorphism trend uses two shadows — one lighter and one darker than the background — to create a soft-extruded look.

🎨

Multi-layer shadows

Combine multiple shadow layers for depth. Material Design cards use a sharp shadow at 2px and a soft diffuse shadow at 8px simultaneously.

📋

Tailwind export

Copies as a Tailwind arbitrary value: shadow-[value]. Spaces are replaced with underscores as required by Tailwind v3+ arbitrary value syntax.

🧩

Neumorphism presets

The Neuo presets generate matched light and dark shadow pairs relative to your chosen background — the key technique for the soft UI aesthetic.

The parameters, and what each does

A box shadow takes horizontal and vertical offset, blur radius, spread radius and colour. Offsets place the shadow relative to the element; blur softens the edge, extending roughly half the blur radius beyond the shadow's boundary in each direction; spread grows or shrinks the shadow before blurring, which is useful for tightening a glow or creating an outline.

The inset keyword flips the shadow inward, which is how pressed states, inner glows and inset borders are built. An inset shadow with zero offset and a small blur produces a subtle recess that reads as depth without any change in layout.

Text shadows take the same parameters minus spread, and multiple shadows are comma-separated on both properties. Shadows are painted in order with the first on top, which matters when layering.

Making shadows look real

The single biggest improvement is to use several layered shadows instead of one. Real shadows are not uniform: they are darkest and tightest near the object and become progressively softer and fainter further away. Stacking three or four shadows with increasing offset and blur, each at lower opacity, approximates that falloff and looks dramatically better than one large blur.

Pick a consistent light source and keep it across the whole interface. Convention is light from above, so shadows fall downward with a positive vertical offset and little or no horizontal offset. An interface where different components imply different light directions looks subtly wrong even to people who cannot identify why.

Use colour rather than black. Pure black at low opacity reads as grey and desaturates whatever is beneath it, whereas a shadow tinted toward the background hue — or a darker, more saturated version of the surface colour — looks far more natural. On coloured backgrounds this is the difference between a shadow that sits in the design and one that looks pasted on.

Performance and dark mode

Large blur radii are expensive. Shadow rendering cost scales with the blurred area, so a full-width element with a 100 px blur is genuinely costly, and animating blur radius forces a repaint every frame. If a shadow must animate, animate opacity on a pre-rendered shadow layer instead, which the compositor can handle without repainting.

box-shadow follows the element's border box and its border radius, but not the shape of its content. For an irregular shape or a transparent PNG, filter: drop-shadow() is the right property — it follows the alpha channel, which is why it works on icons and cut-out images where box-shadow would draw a rectangle.

Dark interfaces need a different approach entirely. A dark shadow on a dark background is nearly invisible, so depth is conveyed by making elevated surfaces lighter rather than by casting shadows — the approach Material Design formalised with elevation overlays. A subtle light border on the top edge, suggesting a highlight rather than a shadow, is often more effective than any shadow at all.

Frequently Asked Questions

What is the CSS box-shadow syntax?

box-shadow: [inset] h-offset v-offset blur spread color; Multiple shadows are comma-separated. Positive h-offset moves right, positive v-offset moves down.

How do I use neumorphism?

Pick a mid-tone background color, then use two shadows: one lighter than the background (offset top-left) and one darker (offset bottom-right). The presets generate this automatically.

How does Tailwind export work?

Tailwind v3+ supports arbitrary values like shadow-[0px_4px_6px_rgba(0,0,0,0.1)]. Spaces in the value are replaced with underscores, and commas for multi-layer shadows are replaced with ,_.

Why do my shadows look fake?

Usually a single large blur at high opacity in pure black. Layer three or four shadows with increasing offset and blur at decreasing opacity to mimic real falloff, and tint the colour toward the background rather than using black.

How do I shadow a transparent PNG or an irregular shape?

Use filter: drop-shadow(), which follows the alpha channel. box-shadow follows the rectangular border box and would draw a box around it.

How do I make an inset (inner) shadow?

Turn on inset for a layer. The shadow is then drawn inside the border box instead of outside it, which is how you get pressed buttons, input wells and the recessed half of a neumorphic control. Offsets work the same way, but the light now reads as coming from outside the hole — so a positive vertical offset shadows the top inner edge, not the bottom outer one.