Skip to content
All tools
English

CSS box-shadow generator

Start from a preset or a blank layer, adjust it while you watch the preview, and copy one line of CSS.

Runs in your browser, nothing is uploaded
16px
Shadow layers

    How to use it

    1. Pick a preset

      Subtle, soft, layered, sharp or inset, or start from one plain layer.

    2. Tune each layer

      Offset X and Y, blur, spread, colour, opacity and inset. Add up to six layers.

    3. Copy the CSS

      One box-shadow declaration with every layer, ready to paste.

    The box-shadow values

    box-shadow: inset? x y blur spread colour. X and Y move the shadow right and down (negative values go left and up). Blur softens the edge; 0 gives a hard edge. Spread grows or shrinks the shadow before blurring, so a negative spread with a large blur gives a shadow that only shows below the element. inset draws the shadow inside the box, as if it were pressed in.

    Why layered shadows look better

    Real objects cast shadows that are sharp and dark close to the object and soft and light further away. One large blurred shadow cannot do both. Stacking several low-opacity layers, each with double the offset and blur of the one before, gets much closer to real light. The Layered preset does exactly that.

    Shadows in dark mode

    Dark shadows barely show on dark backgrounds. In dark themes, use a slightly lighter surface colour for raised elements, or a thin light border, instead of relying on the shadow alone. Set the preview background to your page colour to see how it will really look.

    Need the exact colour code for your shadow? Convert it with the colour converter. Building a card with a gradient? Try the gradient generator.

    Frequently asked questions

    What is the difference between box-shadow and drop-shadow?
    box-shadow follows the rectangle of the element (with its border-radius). filter: drop-shadow() follows the visible pixels, so it suits transparent PNGs and icons, but it has no spread and no inset.
    Do shadows slow a page down?
    A few static shadows are cheap. Animating large blurred shadows can cost frames on slow phones; animate the opacity of a shadowed layer instead of the shadow itself.
    How do I put a shadow on one side only?
    Use an offset towards that side, a blur, and a negative spread of about the same size as the blur. The spread pulls the shadow in on the other sides.