Skip to content
Language:en

CSS box-shadow generator

Build layered CSS box shadows with sliders: offset, blur, spread, colour, opacity and inset.

Presets
Shadow layers
    Preview
    CSS

    Runs entirely in your browser. Your files never leave your device.

    About this tool

    A good shadow makes a card float, a button look pressable and a modal stand out from the page. The softest, most realistic shadows are made of several layers: a tight one close to the element and a wide, faint one further away. Start from a preset, soft, layered, hard offset, glow or inner, and tune each layer with sliders while the preview updates.

    Every layer has its own horizontal and vertical offset, blur, spread, colour and opacity, and can be turned into an inset shadow for pressed or engraved effects. Change the box colour, page background and corner radius to see the shadow in context, then copy the box-shadow declaration or share it as a link.

    How it works

    1. Pick a preset.
    2. Adjust the layers, or add up to six.
    3. Set the box colour, background and corner radius for the preview.
    4. Copy the CSS.

    Colours are written as rgba() so opacity is part of each shadow. Layers listed first are drawn on top.

    Worked example

    A soft card shadow made of two layers: 0 1px 2px rgba(0,0,0,0.08), 0 8px 24px rgba(0,0,0,0.12). The tight layer defines the edge, the wide faint one gives the impression of height.

    For a pressed button, switch one layer to inset with a small offset: inset 0 2px 4px rgba(0,0,0,0.2).

    Good to know

    • Shadows look more natural when they fall slightly downward, as if lit from above.
    • On dark backgrounds, shadows barely show; use a lighter border or a subtle glow instead.
    • Animate opacity or transform rather than the shadow itself for smoother hover effects.

    Frequently asked questions

    Why use several layers?
    Real shadows are sharp near an object and soft far from it. Stacking a small and a large shadow imitates that and looks more natural than one big blur.
    What does spread do?
    It grows or shrinks the shadow before blurring. A negative spread with a large blur gives a soft shadow that stays under the element.
    Does box-shadow slow down a page?
    Static shadows are cheap. Animating large blurred shadows can cost frames on low-end phones; animate opacity of a pseudo-element instead.