Skip to content
Toolcroft

CSS Box Shadow Generator

Color Tools

Visually build CSS box-shadow declarations with multiple layers. Adjust offsets, blur, spread, color, and opacity. Copy the CSS or Tailwind equivalent.

Tailwind presets

Style presets

CSS
box-shadow: 0px 4px 12px 0px rgba(0, 0, 0, 0.25);
Tailwind
shadow-[0px_4px_12px_0px_rgba(0,0,0,0.25)]

Arbitrary custom value

How to use this tool

  1. Adjust the shadow. Use the number fields to set x offset, y offset, blur, and spread, then choose a color and opacity. Or select a preset to load a complete shadow stack.
  2. Add more shadows. Click "Add Shadow" to stack multiple box-shadow layers.
  3. Copy the CSS. Click the copy button next to the generated CSS to use it in your stylesheet.

CSS box-shadow syntax

The full box-shadow syntax is:

box-shadow: [inset] <offset-x> <offset-y> [<blur>] [<spread>] <color>;
ValueDescription
insetOptional. Makes the shadow appear inside the box.
offset-xHorizontal offset. Positive moves right, negative moves left.
offset-yVertical offset. Positive moves down, negative moves up.
blurBlur radius in px. 0 = sharp edge. Larger = softer shadow.
spreadSpread radius. Positive expands, negative contracts the shadow.
colorAny CSS color value. Use rgba() for transparency.

Multiple shadows

You can stack multiple shadows by separating them with commas. The first shadow listed appears on top. This is useful for layered depth effects or combining an outer drop shadow with an inner highlight.

Neumorphism pattern

Neumorphism (soft UI) creates a pressed-into-surface or raised-from-surface effect by pairing two shadows in opposite directions - one light, one dark - with matching background colors:

/* Raised neumorphic element */
box-shadow:
  6px 6px 12px rgba(0,0,0,0.2),
  -6px -6px 12px rgba(255,255,255,0.7);

/* Pressed/inset neumorphic element */
box-shadow:
  inset 4px 4px 8px rgba(0,0,0,0.2),
  inset -4px -4px 8px rgba(255,255,255,0.7);

The element's background must closely match the container background for the illusion to work.

Design system shadow scale

Tailwind CSS 3.4 provides these default shadow utilities. Select a preset above to load the complete editable stack; the named utility is copied only while every layer still matches the listed geometry, inset state, black color, and alpha:

TokenCSS valueUse
shadow-sm0 1px 2px 0 rgba(0,0,0,0.05)Subtle lift on cards
shadow0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1)Default card shadow
shadow-md0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1)Dropdowns, popovers
shadow-lg0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1)Modals, dialogs
shadow-xl0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1)Full-screen overlays
shadow-2xl0 25px 50px -12px rgba(0,0,0,0.25)Large elevated cards, dialogs
shadow-innerinset 0 2px 4px 0 rgba(0,0,0,0.05)Input focus, pressed states

Performance

box-shadow is composited by the GPU and does not trigger layout or paint on surrounding elements. This makes it safe to animate - use CSS transitions or @keyframes on box-shadow for smooth hover effects without performance concerns. (Contrast this with filter: drop-shadow(), which can trigger repaints on complex shapes.)

Frequently asked questions

What do the box-shadow values mean?

The CSS box-shadow shorthand is: [inset] offset-x offset-y blur-radius spread-radius color. Offset-x and offset-y can be negative. Blur-radius must be ≥ 0 - larger values create softer shadows. Spread-radius expands (positive) or contracts (negative) the shadow before blurring.

What is an inset shadow?

An inset shadow is drawn inside the element's border, creating a "pressed" or "cut out" effect. Add the inset keyword before the offset values.

Can I have multiple shadows?

Yes. CSS box-shadow accepts a comma-separated list of shadows. Shadows are rendered front-to-back - the first shadow in the list appears on top. Use this to combine inner glows with outer drop shadows, or to simulate layered depth.

How do I convert box-shadow to Tailwind?

The tool matches Tailwind 3.4 shadow-sm, shadow, shadow-md, shadow-lg, shadow-xl, shadow-2xl, and shadow-inner only when the complete ordered shadow stack matches the default geometry, inset state, black color, and alpha (allowing a small rounding tolerance for alpha). Other values use a Tailwind arbitrary class with underscores for whitespace.

Browse all color tools