💻 Web Dev Tools

CSS Box Shadow Generator

Build CSS box shadows visually with sliders for X offset, Y offset, blur, spread and opacity. Stack multiple shadow layers, pick from Material Design and Tailwind elevation presets, preview on different element shapes, and copy the CSS in one click.

Multiple layered shadows Material Design & Tailwind presets Inset shadow support 3 preview shapes · Copy CSS
AdSense — 728×90 Leaderboard

CSS Box Shadow Generator Tool

Presets
Shadow layers
X Offset 0px
Y Offset 0px
Blur radius 0px
Spread radius 0px
Colour & opacity 40%
Inset shadow
BG:
Preview
Generated CSS
AdSense — 728×90 Leaderboard
Need to build your CSS Flexbox layout next?
The free CSS Flexbox Generator lets you configure all flexbox properties visually — justify-content, align-items, flex-wrap, gap — with a live preview and copy-ready CSS. Perfect alongside box shadow work.
⬛ CSS Flexbox Generator →
⭐ User Ratings

Rate this tool

4.9
Based on 7,318 ratings
5
6,659
4
439
3
146
2
37
1
37
Was this box shadow generator helpful?
Thank you for your rating!
Features

Multi-layer shadows and elevation presets — features most CSS tools skip

Most box shadow generators let you control one shadow. This tool stacks unlimited layers, each with independent controls. Add Material Design elevation or Tailwind preset shadows as a starting point, then customise per layer — something no other free tool offers together.

🎚️
Full slider controls
X offset, Y offset, blur radius and spread radius each have a dedicated slider with live numeric readout. Range: X/Y ±100px, blur 0–100px, spread ±50px. All update the preview in real time.
🎨
Colour + opacity separately
Pick the shadow base colour with a colour picker, then set opacity independently with a slider. This generates rgba() values — more flexible than hex colour alone, matching how real design systems specify shadows.
📚
Multi-layer shadow builder
Add multiple shadow layers with one click. Each layer has full independent controls. Toggle layers on/off without deleting them. Reorder by clicking. The CSS output combines all enabled layers into one box-shadow property — the real production output.
🎯
Preset library
One-click presets: Soft (subtle ambient), Hard (sharp offset), Float (elevation card), Glow (coloured brand shadow), Material dp2/dp8/dp16 (Android elevation system) and Tailwind sm/md/lg/xl (utility CSS shadows). Apply and then customise.
🔲
Inset shadow toggle
Toggle inset on any individual layer to make it an inner shadow. Inset shadows appear inside the element rather than outside — used for pressed button states, recessed inputs and neumorphic design effects. Mix inset and outset layers on the same element.
📋
Copy as CSS variable
In addition to copying the raw box-shadow value, copy the shadow as a CSS custom property declaration (--shadow: value) ready to paste into your design tokens file. Absent on most competing tools. One click produces the complete variable definition.
How to use

How to build a CSS box shadow

1
Start from a preset or from scratch
Click a preset button to load a named shadow — Soft, Hard, Float, Glow, or a Material/Tailwind system shadow. The preset fills in all layers with correct values. Or leave the default single layer and adjust sliders manually from the zero state.
2
Adjust the active layer
The currently selected layer (highlighted in the layer list) is controlled by the sliders below. Move X offset right to cast a shadow to the right. Increase Y offset to cast it downward. Increase blur for a softer, more diffuse shadow. Use spread to expand the shadow beyond the element edges.
3
Set colour and opacity
Click the colour swatch to open the colour picker. Use the opacity slider to control shadow transparency — most professional shadows use a dark colour at low opacity (10–40%) rather than a true grey. This creates more natural-looking shadows across different background colours.
4
Add more layers for depth
Click Add layer to add a second shadow layer. Professional elevation shadows typically use two layers: one large and diffuse (simulating ambient light) and one small and tight (simulating direct light). The Material Design dp8 preset shows this technique — study it as a starting point.
5
Preview on different shapes and backgrounds
Switch between Card, Button and Circle preview shapes to see how your shadow looks in different contexts. Try the Dark background to verify your shadow reads correctly in dark mode. A shadow that looks good on white may disappear on dark backgrounds.
6
Copy and paste
Click Copy CSS to copy the complete box-shadow declaration. Click Copy as var() to copy it as a CSS custom property for your design token system. Paste directly into your stylesheet, Figma CSS export, Tailwind config, or any CSS-in-JS setup.
Why LazyTools

How this compares to other CSS shadow generators

FeatureLazyToolsCSS ScanCSSmaticShadow Brumm
Visual slider controlsYesYesYesYes
Multiple shadow layersYes — unlimitedNoNoYes
Material Design presetsYes — dp2/8/16NoNoNo
Tailwind shadow presetsYes — sm/md/lg/xlNoNoNo
Copy as CSS variableYesNoNoNo
Inset shadow per-layerYesNoYesYes
Multiple preview shapesYes — 3 shapesOne onlyOne onlyOne only
Dark background previewYesNoNoNo
Quick reference

CSS box-shadow property values explained

ValueSyntax exampleWhat it controls
X offset4pxHorizontal offset. Positive = right, negative = left
Y offset4pxVertical offset. Positive = down, negative = up
Blur radius10pxSoftness. 0 = hard edge, higher = softer/larger shadow
Spread radius0pxExpands or contracts shadow. Negative shrinks it
Colorrgba(0,0,0,.2)Shadow colour and transparency
insetinsetMakes shadow appear inside the element
Multiple shadowss1, s2, s3Comma-separated list, applied back to front
nonenoneRemoves all shadows from the element
Complete guide

CSS Box Shadow — A Complete Guide for Designers and Developers

The CSS box-shadow property is one of the most powerful and most misused tools in web design. Used well, shadows create a sense of depth and hierarchy — making interactive elements feel tactile and giving content a sense of elevation off the page. Used poorly, they look dated, heavy or artificial. Understanding the six values that control a box shadow — and how to combine multiple shadows for realistic depth — separates professional-looking UIs from amateur ones.

The anatomy of a CSS box shadow

A CSS box shadow takes up to six values: horizontal offset, vertical offset, blur radius, spread radius, colour, and the optional inset keyword. The horizontal and vertical offsets position the shadow relative to the element — positive X casts the shadow to the right; positive Y casts it downward. The blur radius determines how soft or hard the shadow edge is: 0 creates a sharp solid shadow, while higher values create a progressively softer, more diffuse effect. The spread radius expands or contracts the shadow in all directions — a positive spread makes the shadow larger than the element; a negative spread shrinks it.

Why shadows should use rgba() not hex colours

Most beginner implementations use a hex grey like #aaaaaa for shadows. The problem is that hex grey shadows look artificial on coloured or dark backgrounds — a grey shadow on a dark surface produces a muddy effect that does not occur in nature. Professional shadows use a dark base colour (usually black or very dark navy) at low opacity using rgba(). A shadow of rgba(0,0,0,0.15) blends naturally with any background colour it falls on, because the transparency allows the background to influence the shadow tone. This is how Material Design, Apple Human Interface and Tailwind all specify their shadows.

Multi-layer shadows — how professionals create realistic depth

Real-world objects cast two kinds of shadow simultaneously: an ambient shadow — large, soft and diffuse, created by indirect environmental light from all directions — and a direct shadow — small, tighter and more opaque, created by the primary light source. A single CSS shadow can only approximate one of these. Professional elevation systems like Material Design dp8 use two comma-separated shadows: a tight, low-opacity layer at the same offset as the element's tilt, and a larger, more diffuse layer representing ambient light. The visual result is dramatically more natural than any single-layer shadow.

The Material Design elevation system

Material Design defines elevation in density-independent pixels (dp), from dp0 (no shadow) to dp24 (maximum elevation like modal dialogs). Each dp level specifies two shadow layers with precisely calibrated offsets, blur and opacity values. dp1 is used for cards and chips at rest. dp2 is for raised buttons. dp8 is for bottom navigation bars, menus and drawers. dp16 is for navigation drawers when open. dp24 is reserved for dialogs. Implementing these correctly — using two layers with the exact right values — produces the sense of physical depth that defines Material Design's visual language.

Tailwind CSS shadow utilities

Tailwind's shadow utilities — shadow-sm, shadow, shadow-md, shadow-lg, shadow-xl and shadow-2xl — are single-layer shadows with increasing blur and spread. They differ from Material Design in being single-layer (simpler) and in using a combination of transparent black and a coloured shadow (Tailwind adds a second shadow in shadow-md and above using the --tw-shadow-colored property). When using Tailwind, you can customise the shadow colour using shadow-{color} utilities. The generator's Tailwind presets show the exact values behind each utility class.

Inset shadows — inner depth and pressed states

Adding the inset keyword reverses the shadow direction — instead of projecting outside the element, the shadow appears inside it. Inset shadows are used for pressed button states (the button appears to indent when clicked), text input fields (to create a recessed appearance), and neumorphic design patterns where elements appear to be embedded in the surface rather than raised above it. A classic technique is combining an outer shadow (element at rest, elevated) with an inset shadow on the same element's active state (pressed, recessed). Multi-layer support in this generator makes it straightforward to build both states.

Frequently asked questions

CSS box-shadow adds shadow effects around an element's frame. It takes: X offset, Y offset, blur radius, spread radius, colour, and an optional inset keyword. Multiple shadows can be stacked by separating them with commas. The property is applied to the element's border box by default.
Blur radius controls how soft the shadow edges are. At 0px the shadow has a sharp, hard edge identical in size to the element. Higher values create progressively softer, more diffuse shadows that fade out gradually. There is no maximum — large blur values create very large soft shadows used in dramatic glow effects.
Spread radius expands or contracts the shadow in all directions before any blur is applied. A positive spread makes the shadow larger than the element. A negative spread makes it smaller. Negative spread combined with blur and offset creates shadows that peek out from under elements rather than extending equally around them.
Add the inset keyword to the box-shadow value: box-shadow: inset 0 2px 4px rgba(0,0,0,0.1). Toggle the Inset switch on the layer controls. Inset shadows appear inside the element, creating a recessed or pressed effect. You can combine inset and non-inset shadows on the same element by adding multiple layers.
Separate multiple shadow values with commas: box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 8px 24px rgba(0,0,0,0.08). Shadows are rendered back to front — the first in the list appears on top. Use the Add layer button to stack shadows visually and the generator combines them automatically.
Tailwind's shadow utilities from smallest to largest: shadow-sm (0 1px 2px rgba 0.05), shadow (0 1px 3px rgba 0.1 + 0 1px 2px rgba 0.06), shadow-md (0 4px 6px + 0 2px 4px), shadow-lg (0 10px 15px + 0 4px 6px), shadow-xl (0 20px 25px + 0 8px 10px), shadow-2xl (0 25px 50px rgba 0.25). Load these via the Tailwind presets in this generator.
Rgba() allows a transparent shadow that blends naturally with any background colour. A hex grey shadow looks artificial on coloured or dark backgrounds. With rgba(0,0,0,0.15), the dark tint mixes with whatever colour is beneath it, producing shadows that look natural on white, cream, blue or dark backgrounds — matching how shadows actually work in the real world.
Related tools

More free CSS and web dev tools