1. Home
  2. Developer
  3. CSS Box Shadow Generator

CSS Box Shadow Generator

Tune a shadow by eye and copy the box-shadow code.

Runs in your browser · No upload
Presets
Shadow layers (1/6)
Shadow 1
CSS code
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
Tailwind class
shadow-[0_8px_24px_rgba(0,0,0,0.2)]
Paste box-shadow: ... or just the value, then press Import.

How to use

  1. Pick a preset that looks close, or start from the default shadow.
  2. Move the horizontal and vertical offset, blur, spread, shadow color and opacity sliders. The preview box updates immediately.
  3. Press Add layer to stack more shadows, up to six. Each layer has its own inset switch.
  4. Change the box color, background and corner radius to test against conditions like your real page. These only affect the preview and never appear in the code.
  5. Copy the CSS code or the Tailwind class into your stylesheet.

What each value does

Value Meaning Example
Horizontal offset (X) Positive moves the shadow right, negative moves it left 6px
Vertical offset (Y) Positive moves it down, negative moves it up 8px
Blur How much the edge is softened. 0 is a hard edge and negative values are not allowed 24px
Spread Grows (positive) or shrinks (negative) the shadow area. Omitted from the code when 0 -1px
inset Draws the shadow inside the box instead of outside inset 0 2px 8px ...

The syntax is box-shadow: [inset] X Y blur [spread] color. Zero values drop their unit, so you get 0 4px 6px rather than 0px 4px 6px.

Code the presets produce

  • Soft: 0 8px 24px rgba(0, 0, 0, 0.2)
  • Card: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24)
  • Hard offset: 6px 6px 0 rgb(0, 0, 0). Blur 0 gives a flat, comic-style shadow.
  • Glow: 0 0 20px 4px rgba(59, 130, 246, 0.6). No offset, only spread color.
  • Inset: inset 0 2px 8px rgba(0, 0, 0, 0.3)
  • Neumorphism: 8px 8px 16px rgba(0, 0, 0, 0.18), -8px -8px 16px rgba(255, 255, 255, 0.9). A dark and a light layer on opposite sides.

Why stack several layers

A single shadow can only show one kind of falloff. Real shadows are dark and tight near the object and light and wide further away, so two to five layers with different blur look much more natural. The Layered preset doubles offset and blur five times (1, 2, 4, 8, 16). More layers cost a little more to paint, so for long lists with hundreds of visible items, one or two layers is a safer choice.

Import and Tailwind

Paste CSS you already use into Import an existing box-shadow to load it back into the sliders. It reads #f00, #rrggbbaa, rgb(0 0 0 / 25%) and a few color names such as black and white. If a value cannot be read, for example var(--shadow) or calc(), nothing is imported and a notice is shown.

The Tailwind class uses the arbitrary value syntax shadow-[...]. Spaces become _ and the space after each comma is removed, so 0 4px 6px -1px rgba(0, 0, 0, 0.1) becomes shadow-[0_4px_6px_-1px_rgba(0,0,0,0.1)].

Things to watch

  • A shadow does not change layout size, but a parent with overflow: hidden clips the part that spills out.
  • Colors with transparency are written as rgba(). In hex mode the 8-digit #rrggbbaa form is used only when alpha is below 1.
  • On dark backgrounds a black shadow is almost invisible. Raise the opacity or use a light colored glow.

Frequently asked questions

What is the difference between blur and spread?

Blur sets how soft the edge is. Spread sets how large the shadow area is before blurring. A negative spread makes a shadow smaller than the box, which is a common way to get a shadow that shows only along the bottom.

Can I put more than one shadow on an element?

Yes, separate them with commas. The first one is painted on top. This tool builds up to six layers.

How do I make an inner shadow?

Turn on Inset for a layer and inset is added in front of its values. It is used for sunken inputs and pressed buttons.

Does the same code work for text?

Text uses text-shadow, which has similar syntax without a spread value. For a shadow that follows the outline of a transparent PNG or SVG, use filter: drop-shadow().

Related tools: CSS Gradient Generator, CSS Beautify and Minify, Color Converter, CSS Border Radius Generator.

Your values and settings are processed in your browser and never sent to a server.

Can't find the tool you need?

Tell us what you want to do. We build the most requested tools first.