AnyTool
Your files never leave your device. All processing happens locally in your browser.

How do I create a CSS box-shadow?

Open AnyTool CSS Box Shadow Generator, drag the offset, blur and spread sliders, pick a colour and opacity, and toggle inset for an inner shadow. A live preview updates instantly. Add more layers to stack several shadows into one realistic, layered effect, or use Smooth mode to auto-build a soft drop shadow from an elevation and light angle. Copy the ready-to-paste CSS or a Tailwind class — everything runs in your browser, nothing is uploaded.

  • Live preview with adjustable element colour, backdrop and corner radius
  • Per-layer offset X/Y, blur, spread, colour, opacity and inset toggle
  • Stack up to 8 comma-separated layers — add, reorder and remove
  • Smooth-shadow mode builds a realistic layered drop shadow from elevation + light angle
  • Material elevation, soft, hard, glow and inset presets · 100% in your browser

What is

CSS box-shadow

box-shadow is a CSS property that casts a shadow around an element’s frame. Each shadow takes an x and y offset, a blur radius, an optional spread radius, a colour, and an optional inset keyword that draws the shadow inside the element instead of outside. You can list several comma-separated shadows on one element to layer them into richer, more realistic depth.

Generators

Related terms

Drop shadowInset shadowBlur radiusSpread radiusElevation

Frequently Asked Questions

In order they are: horizontal offset, vertical offset, blur radius, spread radius, then a colour, with an optional inset keyword for an inner shadow.

A box-shadow is written as offset-x offset-y blur spread color. Offset-x moves the shadow right (or left if negative) and offset-y moves it down (or up if negative). The blur radius softens the edge — larger values give a bigger, lighter shadow, and it cannot be negative. The spread radius grows the shadow with positive values or shrinks it with negative ones. The colour usually uses rgba() so you can set opacity. Adding the inset keyword draws the shadow inside the box instead of outside. The AnyTool generator exposes each of these as a slider on every layer.

List several comma-separated shadows with growing blur and offset and falling opacity. AnyTool can stack them for you or build a smooth shadow from an elevation and light angle.

A single shadow looks artificial because real shadows are not a uniform blur. The layered technique stacks several box-shadows separated by commas, increasing the offset and blur on each one while easing the opacity down, which reads as a soft, natural shadow. AnyTool lets you add up to eight layers and reorder them, or switch to Smooth mode where you set an elevation and a light angle and it auto-generates a multi-layer stack — the same approach modern design systems like Material, Stripe and Linear use for premium-feeling depth.

A normal shadow is cast outside the element; an inset shadow is drawn inside it, clipped to the padding box, so the element looks pressed in.

Without the inset keyword, box-shadow draws outside the element’s border box, making it look raised above the surface. Adding inset draws the shadow inside the element, clipped to its padding box and following the border radius, so it looks recessed or pressed in — useful for input fields, pressed buttons and neumorphic UI. You can even combine outer and inset shadows on the same element. Each layer in the AnyTool editor has its own inset toggle.

No. The CSS rule and Tailwind class are generated in your browser and nothing is uploaded, logged or stored.

AnyTool CSS Box Shadow Generator runs entirely in your browser. Your shadow is just a model of numbers and colours; the CSS declaration, the full rule with a -webkit fallback and the Tailwind arbitrary value are strings built from it locally. No design data or settings are ever sent to a server, and the page works offline once cached.

Detailed Explanation

How It Works

Box-Shadow Anatomy: Offset, Blur, Spread, Colour and Inset

The CSS Box Shadow Generator builds the box-shadow property from an editable model. Each shadow is offset-x offset-y blur spread color: offset-x and offset-y move the shadow horizontally and vertically (negative values move it left or up), blur softens the edge (larger is bigger and lighter; it cannot be negative), and spread grows the shadow with positive values or shrinks it with negative ones. The colour is emitted as rgba() so opacity is a first-class control. The optional inset keyword draws the shadow inside the element’s padding box (following the border radius) instead of outside it. Each value is a live slider in the editor and the result renders instantly on a sample element whose colour, backdrop and corner radius you can change to test against real surfaces.

  • Order of values: offset-x, offset-y, blur-radius, spread-radius, colour
  • Negative offsets move the shadow left/up; blur cannot be negative
  • Spread expands (positive) or contracts (negative) the shadow
  • Colour is emitted as rgba() so opacity is directly editable
  • inset draws the shadow inside the padding box (recessed) rather than outside
Methodology

Layered and Smooth Realistic Shadows

Because box-shadow accepts a comma-separated list of shadows, the generator models a stack of up to eight layers that you can add, reorder, recolour and remove individually. A single shadow reads as artificial; the layered technique stacks several shadows with progressively larger offset and blur and falling opacity, which the eye reads as one soft, natural shadow — the approach used by Material Design and brand systems like Stripe and Linear. Smooth mode automates this: from an elevation (how high the element floats), a light angle (which direction the shadow is cast), a layer count and an intensity, the pure engine generates a stack using a quadratic distance ramp so near layers stay tight and dark while far layers spread wide and faint. The generated stack drops straight into the layer editor for manual fine-tuning, and curated presets cover Material elevation levels, soft, hard, neon glow and inset/neumorphic styles.

  • box-shadow accepts a comma-separated list; the editor stacks up to 8 layers
  • Layered shadows grow offset and blur while opacity eases down for realism
  • Smooth mode derives a stack from elevation, light angle, layer count and intensity
  • A quadratic ramp keeps near layers tight/dark and far layers wide/faint
  • Presets: Material elevation, soft, hard, neon glow and inset/neumorphic
Privacy & Security

Privacy, Performance and Browser Support

All generation is client-side JavaScript: the shadow stack is a model of numbers and colours, and the CSS declaration, the full rule (with a -webkit- line for very old WebKit) and the Tailwind arbitrary value are strings built locally, so nothing is uploaded, logged or stored and the page works offline once cached. The tool is honest about cost: each comma-separated layer is painted separately and very large blur radii are expensive, so stacking many layers or animating big shadows can drop frames on older mobile devices — a fixed shadow promoted with will-change only when needed performs better. inset shadows are clipped to the padding box and follow the border radius, while normal shadows fall outside the border box, and shadow colours read very differently on light versus dark backdrops, so users are advised to preview against the actual target surface. box-shadow is supported in every modern browser.

  • Everything runs in the browser — no upload, no server, works offline
  • Exports a CSS declaration, a full rule with a -webkit- fallback, and a Tailwind class
  • Each layer paints separately; large blur radii are GPU/paint-expensive
  • inset shadows clip to the padding box; normal shadows fall outside the border box
  • box-shadow is supported across all modern browsers
CSS box-shadow generation: in-browser (AnyTool) vs typical online generators
CapabilityAnyToolTypical online generators
Multiple layersStack up to 8, reorderableOften a single shadow
Smooth / realistic modeElevation + light angle auto-stackRare
Inset supportPer-layer inset toggleSometimes
Opacity controlDedicated per-layer alpha sliderOften colour-only
PreviewAdjustable element colour, backdrop, radiusFixed swatch
Export formatsCSS declaration, full rule (+-webkit), TailwindOften CSS only
PresetsMaterial, soft, hard, glow, inset groupsVaries
ProcessingRuns in your browser, no CDNOften server-side / API
PrivacyNever uploaded, not stored, works offlineMay transmit or log
Cost / signupFree, no signupOften ad-heavy or gated

AnyTool composes every shadow locally in the browser and uploads nothing.