CSS generators

CSS Box Shadow Generator

Design natural, layered shadows visually, from one smooth elevation slider or layer by layer, for box-shadow, drop-shadow() and text-shadow.

  • Free foreverNo trial, no paywall, no usage limits.
  • No sign-upOpen the page and start. We never ask for an email to use a tool.
  • PrivateEverything runs in your browser. Your input is never uploaded or stored on our servers.
  • Works offlineOnce the page has loaded, the tool keeps working without a connection.
box-shadow: follows the element's rectangle and border radius. Supports spread and inset.filter: drop-shadow(): follows the actual shape, including transparent areas of images and SVGs.text-shadow: shadows behind each glyph, for glows, depth and legibility.
Undo (Ctrl/⌘+Z)Redo (Ctrl/⌘+Shift+Z)Randomize: surprise me with a new designReset to the starting designCopy a link that reopens this exact design

Preview

Live preview. Use the background buttons to check the shadow on light, dark and your own page color.
Checkerboard: shows exactly which parts are transparent.White background, like a light-mode page.Near-black background, to check the design in dark mode.Your own background color: test on the surface the design will really sit on.
5 layers · 0 0.6px 1.3px rgb(15 23 42 / 4.4%), 0 2.6px 5.1px rgb(15 23 42 / 4.4%), 0 5.8px 11.5px rgb…

Shadow

Build the shadow by hand, from one elevation value, or from Material Design levels.
Edit each shadow layer by hand: offset, blur, spread, color.Generate natural, eased layers from one elevation slider.Material Design elevation levels from 0 to 24 dp.

Layers (5)

Several soft layers look more natural than one big shadow. The first layer paints on top.
Add a layer
  • Hide layerMove layer up (paints above)Move layer down (paints below)Duplicate layerDelete layer
  • Hide layer
  • Hide layer
  • Hide layer
  • Hide layer

Selected layer

Drag the pad to aim the shadow, or type exact values.
OffsetDrag to set the horizontal and vertical offset together. Hold Shift to snap to 5px.
Horizontal offset. Positive moves the shadow right.
px
Vertical offset. Positive moves it down, as light from above does.
px
How soft the edge is. Larger blur reads as higher above the page. It can't be negative.
px
Grows (positive) or shrinks (negative) the shadow before blurring. Negative spread keeps big blurs from bleeding out the sides.
px
Tinting the shadow toward the background or element hue looks more natural than pure black.
Opacity of this color. 0% is fully transparent.
%
Draws the shadow inside the box, so the surface looks pressed in or carved.

Element

Only affects the preview, so you can see the shadow on your real colors. It is not part of the output.
The element's background in the preview. Neumorphism needs it to match the page color.
box-shadow follows border-radius, so rounded cards get rounded shadows.
px
Paste existing CSS
Paste box-shadow, text-shadow or filter: drop-shadow() code (a value, a declaration or a whole rule). The property you paste picks the mode.Your code stays in this browser tab. It is not saved or uploaded.

Code

Plain CSS for the current mode.An exact arbitrary-value class, plus the nearest built-in utility.Sass with one color variable and per-layer opacity, ready for design tokens.
Copy CSSDownload shadow.css
In dark mode, shadows barely read on near-black. Lift elevated surfaces with a lighter background or a faint light border instead.

Presets

One click applies a preset. Undo (Ctrl/⌘+Z) brings your previous design back.
  • Five eased layers: tight and dark near the element, wide and faint further out, like real light.
  • A barely-there two-layer shadow for cards and inputs on white.
  • A high, diffuse shadow for modals, popovers and hero cards.
  • Each layer doubles the last (1, 2, 4, 8, 16px): a crisp, natural stack.
  • No blur, solid color: the bold neo-brutalist look.
  • A dark and a light shadow on an element the same color as the page, so it looks extruded.
  • The same pair as inset shadows, so the surface looks pressed in.
  • Material Design elevation 4 (app bars): umbra, penumbra and ambient layers.
  • Material Design elevation 16 (navigation drawers and modal sheets).
  • Zero-offset colored shadows on a dark page read as light, not shade.
  • Thirty hard copies stepping down and right, fading out: the flat-design long shadow.
  • A shadow tinted with the element's own color looks lit, not dirty.

Want a site designed with this level of care? Talk to our team

Quick answer

The CSS box-shadow property draws one or more shadows around an element: box-shadow: x-offset y-offset blur spread color, with an optional inset keyword and commas between layers. Several soft layers look far more natural than one big blur. In Playxoft's free Box Shadow Generator, the Smooth tab builds eased layers from a single elevation value, or you can edit each layer by hand, then copy the CSS, Tailwind class or Sass.

  • Layered shadows
  • Smooth elevation slider
  • Material elevations 0 to 24
  • Box, drop and text shadows
  • Neumorphic presets
  • Paste existing CSS to edit
  • CSS, Tailwind and Sass
  • Undo, redo and share links

How to use the Box Shadow Generator

  1. 1Pick Box shadow, Drop shadow or Text shadow in the toolbar.
  2. 2Start from a Preset, or open Smooth and drag Elevation to generate layered shadows from one value.
  3. 3Fine-tune in Layers: drag the offset pad, then set Blur, Spread, Shadow color and Inset for the selected layer.
  4. 4Check the result on light, dark and your own page color with the background buttons above the preview.
  5. 5To tweak a shadow you already use, paste it into Paste existing CSS; box-shadow, text-shadow and drop-shadow() are all understood.
  6. 6Copy the CSS, Tailwind or SCSS output, or press Share to copy a link to the design.

What is the CSS box-shadow syntax?

Each shadow is a list of lengths and a color, and an element can have as many shadows as you like, separated by commas. The first shadow in the list paints on top.

box-shadow: [inset] <offset-x> <offset-y> [<blur>] [<spread>] <color>;
box-shadow: 0 4px 12px -2px rgb(15 23 42 / 18%);
ValueDefaultWhat it does
insetoffDraws the shadow inside the border box, for pressed or carved looks
offset-xrequiredMoves the shadow right (positive) or left (negative)
offset-yrequiredMoves it down (positive) or up (negative)
blur0Softens the edge; it cannot be negative
spread0Grows or shrinks the shadow before blurring
colorcurrentColorAny CSS color; use transparency so the background shows through

A shadow follows the element's border-radius, does not take up layout space and does not catch clicks. It is clipped by any ancestor with overflow: hidden and by clip-path, which is the usual reason a shadow seems "cut off".

Why do layered shadows look more realistic?

Real shadows have a small, dark core where an object nearly touches a surface and a wide, faint penumbra around it. A single large blur gets one of those right and the other wrong: it either looks muddy or floats with no contact. Stacking layers whose offset and blur grow while each layer stays faint reproduces both.

box-shadow:
  0 1px 1px rgb(0 0 0 / 7%),
  0 2px 2px rgb(0 0 0 / 7%),
  0 4px 4px rgb(0 0 0 / 7%),
  0 8px 8px rgb(0 0 0 / 7%),
  0 16px 16px rgb(0 0 0 / 7%);

The Smooth tab automates this. Elevation sets the outermost offset, an easing curve spaces the inner layers (ease in keeps them tight, doubling gives 1, 2, 4, 8 and 16px), and every layer gets the same opacity a, chosen so that where all n layers overlap the result equals your total: 1 − (1 − a)^n. Tinting the shadow toward a deep slate or navy instead of pure black also makes it feel lit rather than dirty.

How should shadows work in dark mode?

A dark shadow on a near-black page has almost nothing to darken, so elevation that reads clearly in light mode disappears. Three techniques work better:

  • Lighter surfaces for higher elements. Raise a card by making its background a few steps lighter than the page. Material Design's dark theme expresses elevation this way.
  • A faint light edge. A 1px border or 0 0 0 1px rgb(255 255 255 / 8%) ring separates surfaces without any blur.
  • Glows instead of shade. Colored, zero-offset shadows read as light on dark backgrounds (see the Neon glow preset).
.card { box-shadow: 0 8px 24px -6px rgb(15 23 42 / 20%); }
@media (prefers-color-scheme: dark) {
  .card { box-shadow: 0 0 0 1px rgb(255 255 255 / 8%), 0 8px 24px -6px rgb(0 0 0 / 60%); }
}

Use the Dark and custom background buttons above the preview to check both themes before you copy.

box-shadow vs drop-shadow() vs text-shadow: which should I use?

box-shadowfilter: drop-shadow()text-shadow
FollowsThe element's box and border radiusThe actual painted shape, including transparencyEach glyph
SpreadYesNoNo
InsetYesNoNo
Multiple shadowsComma-separatedChain several drop-shadow() functionsComma-separated
Typical useCards, buttons, modalsIcons, transparent PNGs, SVGs, odd shapesHeadlines, glows, legibility over images

drop-shadow() is the only one that hugs a non-rectangular shape, but filter creates a stacking context and becomes the containing block for position: fixed children. An element with clip-path clips its own drop shadow, so put the filter on a wrapper (pair it with the clip-path generator).

Are box shadows bad for performance?

Static shadows are cheap, even with several layers. The cost comes from very large blur radii over big areas and, above all, from animating box-shadow, which repaints the element on every frame. For hover effects, put the larger shadow on a pseudo-element and animate its opacity, which the compositor handles without repainting:

.card { position: relative; box-shadow: 0 1px 3px rgb(0 0 0 / 10%); }
.card::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  box-shadow: 0 16px 40px -8px rgb(0 0 0 / 25%);
  opacity: 0; transition: opacity 200ms ease;
}
.card:hover::after { opacity: 1; }

For glassy panels that combine a shadow with a blurred backdrop, see the glassmorphism generator.

Frequently asked questions

Separate them with commas in a single box-shadow declaration, for example box-shadow: 0 1px 2px rgb(0 0 0 / 10%), 0 8px 24px rgb(0 0 0 / 12%). The first shadow paints on top. A second box-shadow declaration would replace the first, not add to it.
Spread grows the shadow outward (positive) or shrinks it (negative) before the blur is applied. A negative spread with a positive y offset keeps a soft shadow from showing at the sides, which is how you get a shadow that appears only under an element.
Push the shadow down and shrink it with negative spread so its sides tuck under the element, for example box-shadow: 0 10px 8px -8px rgb(0 0 0 / 30%). The spread should be roughly equal to the blur so nothing peeks out at the left and right.
An ancestor with overflow: hidden (or auto) clips anything outside its box, including shadows, and clip-path clips the element's own shadow. Add padding to the clipping container, move the shadow to an element outside it, or use a wrapper with filter: drop-shadow() around a clipped element.
Give the element the same background color as the page, then add two shadows: a darker one offset down and right and a lighter one offset up and left, for example 9px 9px 16px with a muted blue-gray and -9px -9px 16px with semi-transparent white. Add inset to both for a pressed look. Check text contrast, because neumorphism is low contrast by design.
Tailwind v4 renamed the shadow scale: v3's shadow-sm is now shadow-xs and v3's plain shadow is now shadow-sm, so check classes after upgrading. For a custom shadow, add a --shadow-* variable inside @theme, such as --shadow-card, to get a shadow-card utility, or use an arbitrary value like shadow-[0_4px_12px_-2px_rgb(15_23_42/18%)].
No. Everything runs in your browser. The Share button stores the design in the part of the link after the # sign, which browsers never send to a server.

Last updated by the Playxoft engineering team.

From the designers who built this tool

Want your site to look this polished?

Consistent color, crisp typography and fast pages are what make a site feel premium. We build accessible, high-converting websites with design systems that stay consistent everywhere. Send us your site and we will share honest recommendations, free.