CSS Free, no sign-up

CSS box-shadow generator

Choose a shadow layer and change its offset, blur and spread — the preview updates instantly and ready-made CSS for box-shadow appears below.

Result
Ready-made CSS
.box {
  border-radius: 16px;
  box-shadow: 0 10px 30px 0 rgba(0, 0, 0, 0.2);
}

How to use it

  1. Start from a preset (soft, hard, layered, inner, glow) or build a shadow from scratch.
  2. Pick a layer and adjust the x and y offsets, the blur radius (blur) and the spread (spread). Tick inset for an inner shadow.
  3. Choose a color and opacity — in the code they are written as rgba(). “+ Add layer” gives you up to 5 layers.
  4. Change the box color, border-radius and the page background to test the effect in realistic conditions, then click “Copy”.

How it works

box-shadow syntax

Each shadow has five parts: horizontal offset, vertical offset, blur radius (blur), spread radius (spread) and color. Adding inset at the start draws the shadow inside the element. Blur cannot be negative and 0 gives a hard edge; spread can be negative and shrinks the shadow. A shadow does not affect layout and takes up no space.

box-shadow: 0 10px 30px 0 rgba(0, 0, 0, 0.2);

Multiple shadows and layer order

Shadows are separated by commas. The first one in the list is painted on top and the rest sit beneath it. For a soft, natural look designers usually stack several small shadows instead of one big one: offset and blur roughly double with every layer.

box-shadow:
  0 1px 2px rgba(0, 0, 0, 0.1),
  0 4px 8px rgba(0, 0, 0, 0.1),
  0 16px 32px rgba(0, 0, 0, 0.1);

inset, spread and the ring effect

inset paints the shadow inside the element — above the background but below the content — which suits pressed buttons and input fields. With a blur of 0 and a positive spread, the shadow becomes a solid ring: 0 0 0 3px looks like a colored border and does not shift the layout.

box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.3), 0 0 0 3px #2563eb;

box-shadow, drop-shadow and text-shadow

box-shadow always follows the rectangular box of the element and its border-radius. To trace the outline of a transparent PNG or an SVG, use filter: drop-shadow() — it has no spread and no inset. For text there is text-shadow: three lengths (x, y, blur) and a color.

filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.25));
text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);

FAQ

Why is my shadow not visible?

Common causes: a parent with overflow: hidden clips the shadow, or the shadow color matches the background or is too transparent. Also, an outer shadow is not painted inside the element's own box, so on an element with a transparent background it shows only around the edges.

How do I add a shadow to one side only?

Combine a negative spread with an offset: box-shadow: 0 8px 8px -8px rgba(0, 0, 0, 0.5) produces a shadow on the bottom edge only. The negative spread pulls the shadow in on every side and the offset pushes it out on the side you want.

Can box-shadow be animated?

Yes, transition: box-shadow 0.2s works. But a shadow with a large blur is repainted on every frame. A lighter approach is to put the shadow on an ::after pseudo-element and animate only its opacity.

Is box-shadow enough for a focus indicator?

No. In Windows High Contrast mode (forced-colors) the browser removes shadows. Draw the focus ring with outline and keep the shadow as extra decoration.

This topic in the HTML & CSS course

More CSS tools

CSS gradient generator Linear, radial and conic gradients: pick colors, angle and stops, then copy the code. Flexbox generator and playground Try flex properties on a container and its items: direction, alignment, gaps and ready-made CSS. CSS Grid generator Set columns and rows, gaps and alignment, then copy the ready-made grid code. Cubic-bezier generator Drag the control points of an easing curve and copy the ready-made CSS transition. SVG animation generator Pick a shape and an effect — get inline SVG and CSS keyframes ready to paste. CSS specificity calculator Type selectors to see their (a,b,c) weight, a color-coded breakdown and which rule wins. CSS box model visualizer See content, padding, border and margin as a DevTools-style diagram and copy the CSS. CSS transform generator Move, rotate, scale and skew an element, see its original position and copy the code. CSS clamp() calculator Enter min and max font size and viewport width — get a ready clamp() for fluid typography. Color contrast checker (WCAG) Check text and background contrast against WCAG AA and AAA, and fix a failing pair of colors. CSS clip-path generator Polygons, bevels, arrows and circles: drag control points on the live canvas and copy ready-made CSS. CSS glassmorphism generator Frosted glass effect: backdrop-filter blur, saturation, border highlight and clean CSS. CSS border-radius (Blob) generator Organic shapes and 8-value border-radius: tune horizontal and vertical corner radii. CSS Stacking Context & z-index Visualizer Why z-index: 9999 fails! Explore CSS Stacking Contexts in interactive 3D exploded layers with transform, opacity and isolation triggers. CSS aspect-ratio & object-fit Generator Eliminate squished images & CLS layout jumps: live aspect-ratio proportions and interactive object-position focal point. CSS Filters Studio & Generator Photo effects without design tools: blur, contrast, hue-rotate, sepia, and trending Instagram-style presets. OKLCH Color Picker & Palette Generator Perceptually uniform brightness & vibrant Display P3 colors: OKLCH picker, design system scales, and fallbacks. CSS Scroll-driven Animations Generator Scroll-linked animations without JavaScript: animation-timeline scroll() & view(), reading progress bar & reveal on scroll. CSS Container Queries (@container) Generator Beyond viewport media queries: components adapt directly to their parent container width. Live resizer & @container rules.
WhatsApp