UtilityKit

500+ fast, free tools. Most run in your browser only; Image & PDF tools upload files to the backend when you run them.

Box Shadow Generator

Tune blur, spread, offsets, color, and inset shadows with an instant CSS preview.

About Box Shadow Generator

Box shadows are one of the most effective ways to communicate depth and hierarchy in UI design, but writing them by hand means juggling four numeric values, an optional inset keyword, and an RGBA color — all in one declaration. The Box Shadow Generator lets you dial in offset, blur, spread, and opacity through sliders, so you see the result before committing a single character to your stylesheet. Stack multiple shadow layers to mimic realistic ambient and key lighting, the same technique used in Material Design elevation scales. Inset mode flips the shadow inward for pressed button states and recessed input wells. The color picker includes alpha control so you can build soft, photorealistic shadows without harsh dark borders. Once satisfied, copy the vendor-clean declaration straight to your CSS or design token file.

Why use Box Shadow Generator

Visual Iteration

Drag sliders to change offset, blur, and spread in real time instead of editing magic numbers in a text file, saving the back-and-forth between code editor and browser DevTools on every tweak.

Layered Depth

Stack a tight key shadow with a diffuse ambient shadow to mimic natural lighting on cards and modals. Multi-layer shadows look far more realistic than a single heavy declaration and match Material Design elevation conventions.

Inset Support

Switch to inner shadows instantly to style pressed button states, inset form fields, or recessed panels. The same sliders control the inset geometry, so you iterate just as quickly as on outer shadows.

Token-Friendly

Copy clean values into a design-system elevation scale like --elevation-1 through --elevation-4. Consistent shadows across components become a repeatable token rather than per-component guesswork.

RGBA Alpha

The integrated color picker exposes both hue and opacity so you can keep shadows soft and translucent. Lower alpha values read more naturally on both light and dark surfaces than fully opaque black shadows.

Copy-Ready CSS

One click copies the complete box-shadow declaration with no vendor prefixes needed in modern browsers. Paste directly into your stylesheet, Tailwind config, or CSS-in-JS theme object without editing.

How to use Box Shadow Generator

  1. Set the horizontal and vertical offset sliders to position the shadow light source
  2. Drag the blur radius slider to soften or sharpen the shadow edge
  3. Adjust spread to grow the shadow footprint or use negative values to tighten it
  4. Open the color picker, choose a shadow color, and lower alpha for natural depth
  5. Toggle the Inset switch to create an inner shadow for pressed or recessed elements
  6. Click Copy CSS to grab the finished box-shadow declaration for your stylesheet

When to use Box Shadow Generator

  • When building a card component and need consistent, realistic elevation across multiple surface levels
  • When styling a modal or drawer that must float visually above the page content
  • When designing a pressed or active button state that needs an inset shadow instead of a raised one
  • When creating a design-system elevation scale and need reproducible shadow tokens
  • When porting a Figma design to CSS and the shadow values aren't obvious from the design file
  • When adding depth to a dark-mode UI and need translucent shadows that don't look muddy

Examples

Subtle card

Input: x:0, y:2, blur:8, spread:0, rgba(0,0,0,0.12) stacked with y:1, blur:3, rgba(0,0,0,0.08)

Output: box-shadow: 0 2px 8px rgba(0,0,0,0.12), 0 1px 3px rgba(0,0,0,0.08);

Floating modal

Input: x:0, y:24, blur:48, spread:-12, rgba(0,0,0,0.25)

Output: box-shadow: 0 24px 48px -12px rgba(0,0,0,0.25);

Inset pressed button

Input: inset enabled, x:0, y:2, blur:4, spread:0, rgba(0,0,0,0.2)

Output: box-shadow: inset 0 2px 4px 0 rgba(0,0,0,0.2);

Tips

  • Stack two shadows — one tight (0 2px 4px, low opacity) for close contact and one diffuse (0 8px 24px, lower opacity) for ambient — to get realistic depth without a heavy look
  • Keep the y-offset larger than the x-offset to simulate overhead lighting, which matches how users expect light to fall in most UI contexts
  • Stay in the 0.06–0.15 alpha range for outer shadows; darker values look painted-on rather than natural
  • Negative spread values shrink the shadow footprint before blurring, useful for creating a soft glow that stays close to the element edge
  • Store finalized shadow values as CSS custom properties like --elevation-1 and --elevation-2 so your entire design system stays consistent

Frequently Asked Questions

What is the difference between blur and spread in box-shadow?
Blur controls how soft the shadow edge is — a higher value creates a feathered, diffuse shadow. Spread independently expands or contracts the shadow's overall size before blurring. Positive spread makes the shadow larger than the element; negative spread shrinks it for a tighter halo effect.
How do I create a Material Design elevation shadow?
Material elevation uses two stacked shadows: a short, dark key shadow and a taller, lighter ambient shadow. For elevation-2, try 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24). Higher elevations increase the y-offset and blur proportionally.
Can I stack multiple box-shadows on one element?
Yes. CSS allows a comma-separated list of shadow declarations on a single element. Shadows are rendered front to back, so the first value in the list appears on top. This generator lets you add multiple layers and preview the combined result live.
Why does negative spread create a tighter shadow?
Spread is applied before blur, so a negative spread shrinks the pre-blur shape. When you then add blur, the diffusion starts from a smaller base, producing a soft halo that hugs the element closely rather than extending outward.
How do inset shadows differ from outer shadows?
Outer shadows render outside the element's border box, creating an elevated look. Inset shadows render inside the border box, making the element appear pushed in or recessed. Inset shadows are useful for pressed buttons, sunken inputs, and inner-glow effects.
Will box-shadow affect element layout or hit area?
No. box-shadow is purely visual and does not affect layout flow, take up space, or expand the element's interactive hit area. The element's position, size, and clickable region remain exactly as defined by width, height, and padding.
How do I make shadows look natural in dark mode?
In dark mode, pure black shadows on dark backgrounds disappear. Use shadows with a slightly lighter color than the surface, or rely on subtle elevation cues through background color differences rather than shadows alone. A very low-opacity white shadow can also simulate light reflection.
Does box-shadow render on rounded corners correctly?
Yes. box-shadow follows the element's border-radius automatically, so shadows on rounded cards and pill buttons conform to the curved shape without any extra work. The shadow traces the visible outline of the element including all corner curves.

Explore the category

Glossary

Offset
The x and y values that shift a shadow horizontally and vertically from the element. Positive x moves the shadow right; positive y moves it down.
Blur Radius
Controls the softness of the shadow edge. A value of 0 produces a sharp, solid shadow; higher values create a progressively more diffuse and feathered edge.
Spread Radius
Expands or contracts the shadow uniformly in all directions before blurring. Positive values enlarge the shadow; negative values shrink it.
Inset Shadow
A box-shadow with the inset keyword renders inside the element's border box, making content appear recessed or pressed rather than elevated.
RGBA
A color format specifying Red, Green, Blue, and Alpha (opacity) channels. Alpha ranges from 0 (fully transparent) to 1 (fully opaque) and is essential for soft, natural shadow colors.
Elevation
In design systems like Material Design, elevation is a scale of box-shadow values that communicates how high above the base surface a component appears to float.