CSS Box Shadow Generator
Layer, ease and preview box-shadow, text-shadow and drop-shadow on light or dark, then copy CSS or a Tailwind class. Drag the preview to move the shadow.
Code
CSS declaration
box-shadow: 0 12px 24px -6px rgba(15, 23, 42, 0.25);Arbitrary-value class
shadow-[0_12px_24px_-6px_rgba(15,23,42,0.25)]Tailwind v4 theme token
@theme {
--shadow-card: 0 12px 24px -6px rgba(15, 23, 42, 0.25);
}
/* then: class="shadow-card" */Custom property
:root {
--shadow-card: 0 12px 24px -6px rgba(15, 23, 42, 0.25);
}
.card {
box-shadow: var(--shadow-card);
}Layers (1 of 16, top first)
Layer 1
HEX, rgb(), rgba(), hsl() or a colour name; an alpha in it sets the opacity.
Builds a stack of faint layers that grow along a curve, like a real soft shadow. Changing these settings replaces your layers.
Elevation
Everyday UI
Smooth elevation
Neumorphism (soft UI)
Inner shadows
Glow
Tailwind CSS defaults
Text shadow
Drop shadow
Preview size, corners and text
These only change the preview; the code holds just the shadow.
Why use a box shadow generator?
The box-shadow property packs up to six unlabelled values into one line, and good shadows usually need two or more of those lines stacked, so tuning one by trial and error in a stylesheet is slow. Here you see every change on a real element at once, on a light and a dark background, and you can drag the shadow into place instead of guessing pixel values. The smooth generator builds the soft, layered shadows that modern interfaces use, the presets cover neumorphism, inner shadows and glows, and the code comes out as plain CSS, a Tailwind class or CSS variables. Everything runs in your browser.
How to make a CSS box shadow
- Pick box-shadow, text-shadow or drop-shadow, then start from a Preset or the default layer.
- Drag the preview to move the shadow, or use the sliders for offset, blur, spread, colour and opacity. Add layer stacks another shadow.
- For a soft, realistic shadow, open Smooth and choose an elevation; fine-tune the generated layers under Layers.
- Check it on Dark or Both, then copy the CSS, the Tailwind class or the CSS variable. Share link saves the whole design in a URL.
CSS box-shadow syntax, value by value
box-shadow: [inset] offset-x offset-y blur-radius spread-radius color;
box-shadow: 0 12px 24px -6px rgba(15, 23, 42, 0.25);| Value | What it does | Typical |
|---|---|---|
| offset-x | Moves the shadow right (positive) or left (negative). | 0 |
| offset-y | Moves it down (positive) or up. Light from above means a positive y. | 2px to 24px |
| blur-radius | Softens the edge; 0 is a hard copy of the shape. Never negative. | about 2× the y offset |
| spread-radius | Grows (positive) or shrinks (negative) the shadow before blurring. A negative spread keeps a big blur tucked under the element. | 0 or negative |
| color | Any CSS colour; a low alpha (5% to 25%) looks natural. Tinting it toward the background hue looks richer than grey. | rgba(…, 0.1) |
| inset | Draws the shadow inside the border, so the element looks pressed in. | optional |
Separate several shadows with commas; the first one is painted on top. The shadow takes the element's border-radius, doesn't affect layout (it never pushes other elements away), and is clipped by an ancestor with overflow: hidden, a common reason a shadow seems to vanish.
Why layered shadows look more natural
A real object under a soft light casts a dark, sharp shadow where it nearly touches the surface and a wide, faint one further out. A single CSS shadow can only be one of those, so it looks either harsh or muddy. Stacking a tight layer and a wide layer, or several in between, gives the gradual falloff your eye expects. Tailwind's own shadow-md to shadow-xl are two layers each for this reason.
How the smooth shadow generator works
The Smooth panel spreads your final offset, blur and spread across several layers along a curve. With the doubling curve, each layer is twice the size of the one before it. Opacity is shared so the stack, where all layers overlap, is exactly as dark as the total you choose: each of n even layers gets 1 − (1 − total)^(1/n). For the default (5 layers, 18% total, 16px down, 32px blur) that's 3.9% per layer:
box-shadow:
0 1px 2px 0 rgba(15, 23, 42, 0.039),
0 2px 4px 0 rgba(15, 23, 42, 0.039),
0 4px 8px 0 rgba(15, 23, 42, 0.039),
0 8px 16px 0 rgba(15, 23, 42, 0.039),
0 16px 32px 0 rgba(15, 23, 42, 0.039);The other curves change how quickly the layers grow (ease-in starts slower, ease-out reaches the full size sooner), and the opacity setting can make the tight layers darker for a crisper contact shadow, or the wide ones darker for a hazier glow, while the total stays the same. The five elevation buttons are starting points from a resting card to a modal dialog.
Tailwind CSS shadow classes
Tailwind v4's default shadows, as the tool reproduces them (pick one under Presets and the Tailwind tab says it's built in):
| Class | CSS |
|---|---|
| shadow-2xs | 0 1px 0 0 rgb(0 0 0 / 0.05) |
| shadow-xs | 0 1px 2px 0 rgb(0 0 0 / 0.05) |
| shadow-sm | 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1) |
| shadow-md | 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1) |
| shadow-lg | 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1) |
| shadow-xl | 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1) |
| shadow-2xl | 0 25px 50px -12px rgb(0 0 0 / 0.25) |
- Upgrading from v3? v4 renamed the small sizes: v3's
shadow-smis nowshadow-xs, and v3's plainshadowis nowshadow-sm. - Custom shadows: write spaces as underscores in an arbitrary value,
shadow-[0_8px_24px_rgba(0,0,0,0.12)], or add--shadow-card: …to@themeand useshadow-card. - Coloured shadows: add a colour utility such as
shadow-blue-500/40to recolour a shadow; it replaces the colours inside the shadow value. - Text and drop shadows:
text-shadow-*needs Tailwind v4.1 or later;drop-shadow-*works on the filter property, and a theme token for it should hold a single shadow.
box-shadow vs drop-shadow() vs text-shadow
| box-shadow | filter: drop-shadow() | text-shadow | |
|---|---|---|---|
| Follows | The box and its border-radius | The visible pixels: PNG transparency, SVG shapes, text | Each letter |
| Spread | Yes | No | No |
| Inset | Yes | No | No |
| Several at once | Comma list, painted independently | Chained functions; each shadows the result so far | Comma list |
| Best for | Cards, buttons, dialogs, focus rings | Icons, logos, cut-out images | Headings over images, outlines, neon |
Neumorphism (soft UI): how it works, and the contrast catch
Neumorphism makes controls look pressed out of the surface: the element is the same colour as the background, a darker shadow falls to the bottom right and a lighter "highlight" shadow to the top left, as if lit from the upper left. Inset versions of both make it look pushed in. The light shadow only shows on a mid-tone surface, so pure white backgrounds don't work. The catch is contrast: a button that differs from its background only by soft shadows is hard to see for many people. WCAG 2.1 success criterion 1.4.11 (Non-text Contrast) asks for 3:1 contrast for the parts of a control needed to identify it, so pair soft UI with a visible border, icon or label colour.
Shadows on dark backgrounds
A black shadow on a near-black page is barely visible, which is why dark interfaces show depth mainly with lighter surfaces: a raised card is a shade lighter than the page behind it. Keep a shadow for separation, usually darker and wider than in light mode, and consider a faint light border (a 1px inset shadow at low white opacity works) to define edges. Use the Both view to check one shadow on light and dark backgrounds side by side, and the Glow presets for coloured light effects that only make sense on dark.
Performance tips
- Static shadows are cheap; animating
box-shadowrepaints every frame. For hover effects, put the larger shadow on a::afterpseudo-element and animate itsopacity. - Very large blur radii cost more to paint; a smooth stack of moderate layers often looks better and paints no slower than one huge blur.
- Prefixes like
-webkit-box-shadowhaven't been needed for years.
More CSS tools
Size the element the shadow sits on with the PX to REM converter, which also converts whole stylesheets and builds fluid clamp() values. Pick a shadow tint that matches your brand with the color converter or a full scheme from the color palette generator, sample a colour straight from a screenshot with the image color picker, and shrink the finished stylesheet with the CSS minifier. Exporting an icon with its new drop shadow? SVG to PNG renders it at any size.
Frequently asked questions
How do I add a box shadow in CSS?
Use the box-shadow property: box-shadow: offset-x offset-y blur spread color, for example box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15). A positive x moves the shadow right and a positive y moves it down. Set the values with the sliders or by dragging the preview, then press Copy next to the CSS. The shadow follows the element's border-radius automatically.
What do the four numbers in box-shadow mean?
In order: the horizontal offset, the vertical offset, the blur radius and the spread radius. Blur can't be negative; 0 gives a hard edge and larger values a softer, wider shadow. Spread grows the shadow on every side before it's blurred, or shrinks it when negative, which is how you keep a shadow under the element instead of around it. A colour completes the shadow, and the inset keyword moves it inside the element.
How do I use multiple box shadows?
List them separated by commas: box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 8px 24px rgba(0, 0, 0, 0.12). The first shadow in the list is painted on top. Combining a small, sharp shadow (the contact shadow right under the element) with a large, soft one (the ambient shadow) looks far more natural than any single shadow, which is why most design systems use two or more. Add, reorder, duplicate and hide layers in the Layers panel.
What is a smooth shadow and how do I make one?
A smooth shadow is a stack of several layers whose offset and blur grow step by step, for example doubling: 1px, 2px, 4px, 8px and 16px. Each layer is faint, but together they fade out gradually like a real shadow instead of ending in a visible blur edge. The Smooth panel builds the stack for you: pick an elevation or set the final distance, blur and opacity, the number of layers and the curve, and the opacities are worked out so the stack is exactly as dark as you asked.
How do I add a box shadow in Tailwind CSS?
Use a built-in class (shadow-2xs, shadow-xs, shadow-sm, shadow-md, shadow-lg, shadow-xl or shadow-2xl) or an arbitrary value with underscores for spaces: shadow-[0_4px_12px_rgba(0,0,0,0.15)]. In Tailwind v4 you can also add your own size to @theme as --shadow-card and use it as shadow-card. The Tailwind tab writes both, and tells you when your layers are exactly one of the built-in classes.
How do I make an inner (inset) shadow?
Add the inset keyword at the start of the shadow: box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.12). An inset shadow is drawn inside the border, so the element looks pressed in, like a text field or a pushed button. Tick Inset on any layer, or start from the Inner shadows presets. Inset and normal shadows can be mixed in one list.
How do I put a shadow on one side only?
Offset the shadow toward that side and pull it in with a negative spread about as large as the blur, so it disappears on the other sides. For a bottom-only shadow use box-shadow: 0 8px 6px -6px rgba(0, 0, 0, 0.3); for the right side only, 8px 0 6px -6px. With inset, the same trick gives an inner shadow along a single edge.
What is the difference between box-shadow and drop-shadow?
box-shadow follows the element's box (its rectangle and border-radius), while filter: drop-shadow() follows the visible shape, so a transparent PNG, an SVG icon or text casts a shadow in its own outline. drop-shadow() has no spread and no inset, and when you chain several, each one shadows everything before it, shadows included. Switch the mode to drop-shadow to see it on a star shape.
How do I make a neumorphism (soft UI) shadow?
Give the element the same colour as its background and add two shadows: a darker one offset down and to the right, and a lighter one offset up and to the left, for example 8px 8px 16px #a3b1c6 and -8px -8px 16px #ffffff on a #e6ebf2 background. Use inset on both for a pressed look. The Neumorphism presets set this up. Soft UI has very low contrast, so add a border or a stronger cue on buttons and fields: WCAG asks for 3:1 contrast on the boundaries of interactive controls.
How do I add a text shadow?
Use text-shadow: offset-x offset-y blur color, for example text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25). It takes no spread and no inset, but you can list several shadows: four 1px shadows in different directions make an outline, and several blurred shadows in one bright colour make a neon glow. Switch the mode to text-shadow; in Tailwind v4.1 and later use text-shadow-sm to text-shadow-lg or an arbitrary text-shadow-[…] class.
Do box shadows slow down a page?
A static shadow is cheap. The cost comes from repainting: animating box-shadow, for example on hover, makes the browser repaint the blur on every frame, which can stutter on low-end phones when the blur is large. A common fix is to put the larger shadow on a pseudo-element and animate its opacity instead. Very large blur radii on many elements, such as every row of a long list, are also worth avoiding.
Do I still need -webkit-box-shadow?
No. Every current browser, and every browser released since about 2011, supports the unprefixed box-shadow property, so the -webkit- and -moz- versions only add weight. Leave them out unless you must support a very old Android or iOS device.
Related tools
More free, private, browser-based utilities — no upload, no sign-up.