Home › Developer Tools › CSS Box Shadow Generator

CSS Box Shadow Generator

Build a box-shadow visually: stack as many layers as you like, drag the sliders and copy clean CSS. Everything runs in your browser, nothing is uploaded.

Last updated:

Presets

Shadow layers

    The first layer is drawn on top. Use the arrows to reorder.

    Layer 1

    px
    px
    px
    px
    %
    Generated CSS
    
            
    Advertisement

    How to use the CSS Box Shadow Generator

    1. Pick a preset such as Soft, Material 8dp or Neumorphism, or start from the default soft shadow.
    2. Select a layer in the Shadow layers list and adjust its x and y offset, blur, spread, opacity and color.
    3. Add layers with + Add layer to build realistic depth; use the arrows to reorder and the eye to hide one temporarily.
    4. Check the preview on a card, circle or button, and change the box and background colors to match your design.
    5. Press Copy CSS and paste the box-shadow declaration into your stylesheet.

    box-shadow values explained

    ValueRequired?What it does
    insetNoDraws the shadow inside the border box instead of outside it.
    offset-xYesMoves the shadow right (positive) or left (negative).
    offset-yYesMoves the shadow down (positive) or up (negative).
    blur-radiusNo (0)Softens the edge. Cannot be negative. 0 gives a hard edge.
    spread-radiusNo (0)Expands (positive) or contracts (negative) the shadow before blurring.
    colorNo (currentColor)Any CSS color. Use rgba() or 8-digit hex for transparency.

    Example: box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.15); moves the shadow 10px down, blurs it over 30px and pulls it in by 5px on every side, so it shows mostly below the element: the soft "card" look used by many design systems.

    Material Design elevation shadows

    Material Design (version 2) builds each elevation from three layers: an umbra (20% opacity), a penumbra (14%) and an ambient shadow (12%). These are the values used by the presets:

    ElevationTypical componentbox-shadow
    2dpRaised button, card at rest0 3px 1px -2px rgba(0,0,0,.2), 0 2px 2px rgba(0,0,0,.14), 0 1px 5px rgba(0,0,0,.12)
    4dpApp bar0 2px 4px -1px rgba(0,0,0,.2), 0 4px 5px rgba(0,0,0,.14), 0 1px 10px rgba(0,0,0,.12)
    8dpMenu, raised card0 5px 5px -3px rgba(0,0,0,.2), 0 8px 10px 1px rgba(0,0,0,.14), 0 3px 14px 2px rgba(0,0,0,.12)
    16dpNavigation drawer0 8px 10px -5px rgba(0,0,0,.2), 0 16px 24px 2px rgba(0,0,0,.14), 0 6px 30px 5px rgba(0,0,0,.12)
    24dpDialog0 11px 15px -7px rgba(0,0,0,.2), 0 24px 38px 3px rgba(0,0,0,.14), 0 9px 46px 8px rgba(0,0,0,.12)

    Tips for better-looking shadows

    • Light comes from above: keep offset-x near 0 and use a positive offset-y so all shadows on a page agree.
    • Layer instead of enlarging: several small shadows that double in offset and blur (1, 2, 4, 8, 16px) look smoother than one big blur. Try the Layered preset.
    • Tint the shadow: on colored backgrounds, use a darker shade of the background color instead of pure black for a richer, less muddy result.
    • Keep opacity low: most UI shadows sit between 8% and 25% opacity.
    • Smooth hover effects: add transition: box-shadow .2s ease and switch to a higher elevation on :hover. When your stylesheet is done, tidy it with the CSS Formatter or shrink it with the CSS Minifier.

    Frequently asked questions

    What is the syntax of box-shadow?

    box-shadow: [inset] offset-x offset-y [blur-radius] [spread-radius] color. The two offsets are required; blur defaults to 0 (a sharp edge), spread defaults to 0, and inset turns it into an inner shadow. Separate several shadows with commas.

    How do multiple box shadows stack?

    The first shadow in the comma-separated list is painted on top and each following one sits underneath it. Layering two to five shadows with growing offset and blur gives a softer, more natural result than a single large shadow.

    What is the difference between blur and spread?

    Blur softens the edge of the shadow: a larger value makes it more diffuse. Spread grows (positive) or shrinks (negative) the shadow before blurring. A negative spread with a large blur is the classic trick for a soft shadow that only shows below an element.

    How do I make a neumorphism (soft UI) shadow?

    Give the element the same color as its background, then add two shadows: a darker one offset down and right (for example 9px 9px 16px with a gray-blue color) and a light or white one offset up and left (-9px -9px 16px). The Neumorphism preset does exactly that; add inset for the pressed look.

    Does box-shadow affect layout or performance?

    No, box-shadow never changes an element's size or position, so it does not move other elements. Very large blurred shadows on many elements, or animating box-shadow, can cost paint time; for hover effects consider animating opacity of a pseudo-element that carries the shadow.

    Do I still need the -webkit-box-shadow prefix?

    Not for any current browser. Unprefixed box-shadow has worked in Chrome, Firefox, Safari and Edge for over a decade. The -webkit- line is only useful for very old Android and iOS browsers, so it is off by default.

    What is the difference between box-shadow and filter: drop-shadow()?

    box-shadow follows the element's box (including border-radius) and supports spread and inset. filter: drop-shadow() follows the actual visible pixels, so it hugs transparent PNGs and SVG shapes, but it has no spread or inset and only one shadow per function.

    Are all the tools on FreeToolCabin tested for quality and accuracy?

    Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

    Related tools

    CSS FormatterBeautify CSS with indent controls and optional property sorting.CSS MinifierMinify CSS with csso or a built-in engine and see the size saved instantly.HTML FormatterBeautify and indent HTML code with a live preview.HTML MinifierMinify HTML: strip comments and whitespace safely and see how many bytes you save.Add Drop Shadow to ImageAdd a drop, long or reflection shadow to PNGs and photos and save a transparent PNG.Color PickerPick any color and get HEX, RGB, HSL, HSV and CMYK codes, shades and a screen eyedropper.Cookie Consent Banner GeneratorDesign a cookie banner with accept, reject and settings buttons and copy the HTML/CSS/JS.HEX to RGBAConvert HEX color codes to CSS rgba() with an opacity slider and one-click copy.Open Graph PreviewPaste OG tags and preview how links look on Facebook, X and LinkedIn.YouTube Embed Code GeneratorCreate responsive YouTube embed code with start time, autoplay, loop and privacy mode.CSS Border Radius GeneratorRound each corner, draw elliptical 8-value radii or random blob shapes and copy the CSS.CSS Button GeneratorDesign CSS buttons with gradients, borders, shadows and hover and active states, then copy the code.CSS Flexbox GeneratorBuild flexbox layouts visually: set container and item properties, then copy the CSS and HTML.Twitter Card GeneratorCreate X / Twitter Card meta tags with Open Graph fallbacks, character counters and a live preview.CSS Grid GeneratorDraw CSS grid layouts: set tracks and gaps, drag to name areas, then copy the CSS and HTML.PX to REM ConverterConvert px to rem or em and back, with a 1-100px table and a whole-CSS converter.Glassmorphism CSS GeneratorDesign frosted-glass UI cards with blur, transparency and border sliders, then copy the CSS.CSS Text Shadow GeneratorLayer CSS text shadows with a live preview and neon, 3D, outline and retro presets.HTML Editor (Live Preview)Write HTML, CSS and JavaScript and see a live, sandboxed preview as you type.HTML to JSX ConverterConvert HTML to valid React JSX: className, htmlFor, style objects, self-closing tags and events.CSS Clip-Path GeneratorDraw CSS clip-path shapes by dragging points: polygons, circle, ellipse and inset. Copy the CSS.CSS Animation GeneratorCreate CSS keyframe animations from 23 presets with live preview, timing controls and Copy CSS.CSS Triangle GeneratorMake CSS triangles in 8 directions with the border trick or clip-path. Set size and color, copy CSS.CSS Loader GeneratorPick from 14 pure CSS spinners and loaders, set color, size and speed, then copy the HTML and CSS.Cubic Bezier GeneratorDrag the control points to design a CSS easing curve, compare it with linear and copy cubic-bezier().CSS Filter GeneratorAdjust blur, brightness, contrast, hue, sepia and drop-shadow on an image and copy the CSS filter.CSS Specificity CalculatorCalculate CSS selector specificity (a, b, c), including :is(), :not(), :has() and :where(), and compare.Google Maps Embed GeneratorTurn an address or coordinates into responsive Google Maps iframe embed code, no API key.Neumorphism CSS GeneratorDesign soft UI neumorphic shapes with live preview and copy the box-shadow CSS.SVG Wave GeneratorMake layered SVG waves for section dividers and export SVG, PNG or a CSS background.SVG Blob GeneratorGenerate random organic SVG blob shapes with gradients and export SVG, PNG or CSS clip-path.CSS Clamp GeneratorTurn min/max sizes and viewport widths into a fluid CSS clamp() value in rem and vw.CSS @font-face GeneratorTurn font files or URLs into ready-to-paste @font-face rules with weights, styles and a preview.CSS Media Query GeneratorBuild @media rules for widths, orientation, dark mode and hover, or get framework breakpoints.CSS Scrollbar GeneratorStyle scrollbars: width, colors, radius and hover, with ::-webkit-scrollbar and scrollbar-color CSS.CSS Sprite GeneratorPack many icons into one sprite sheet PNG and get CSS classes with background-position.CSS Text Gradient GeneratorMake gradient text with background-clip:text: color stops, angle, font preview and fallback CSS.CSS Toggle Switch GeneratorDesign pure-CSS toggle switches: size, colors, shape and animation. Copy accessible HTML + CSS.CSS Color Filter GeneratorTurn a HEX color into a CSS filter that recolors black icons and SVGs, with an accuracy score.CSS Gradient Animation GeneratorCreate animated gradient backgrounds: pick colors, angle and speed, preview live and copy the CSS.CSS Hover Effects GeneratorPick button, link and image hover effects, tweak colors and timing, and copy the HTML and CSS.CSS InlinerMove CSS from style blocks into inline style attributes so HTML emails render in every client.CSS Shape Divider GeneratorCreate wave, tilt, curve and triangle section dividers and copy the SVG, HTML and CSS.CSS Transform GeneratorRotate, scale, skew and translate an element with sliders and copy the CSS transform code.Font Pairing ToolPreview Google Font heading and body pairs on real layouts and copy the embed code and CSS.HTML Accessibility CheckerPaste HTML to find WCAG accessibility problems with impact level, the failing element and a fix.HTML Image Map GeneratorDraw clickable rectangle, circle and polygon hotspots on an image and get image map HTML.SVG ViewerOpen or paste SVG code to preview it live with zoom, backgrounds, size info and PNG export.Pathfinding VisualizerAnimate BFS, DFS, Dijkstra, A* and greedy search on a grid with walls, weights and mazes.CSS Tooltip GeneratorBuild pure CSS tooltips: position, arrow, colors, padding and animation. Copy HTML and CSS.HTML Form BuilderDrag and drop form fields with labels and validation, then copy accessible HTML and CSS code.Iframe GeneratorCreate iframe embed code: size or responsive ratio, border, allow, sandbox, lazy load, live preview.PX to VW ConverterConvert pixels to vw and vh for any viewport size, and vw/vh back to px, with breakpoint tables.SVG Path EditorEdit an SVG path d attribute visually: drag points, edit commands, convert, scale and minify.SVG to CSS Data URITurn SVG code into a small URL-encoded data URI for CSS backgrounds, with Base64 size comparison.SVG to JSXTurn SVG code into a clean React component: camelCase attributes, style objects, TypeScript.Tailwind CSS Cheat SheetSearchable Tailwind class to CSS reference with live previews, class decoder and color palette.Web App Manifest GeneratorCreate a PWA manifest.json and every app icon size from one image, downloaded as a ZIP.CSS Background Pattern GeneratorMake pure-CSS stripes, dots, checkerboard, zigzag and grid backgrounds and copy the code.
    See all 52 Web, HTML & CSS Tools →