فارسی

CSS Box Shadow Generator with Live Preview

Set the offset, blur, spread and colour, start from a preset, and copy the box-shadow rule.

Use this tool in your browser without installing software.

About this tool

Use four sliders to set the horizontal and vertical offset, blur and spread. Choose a colour with a HEX code or RGB values, then adjust its opacity separately. Start from one of six presets, from a soft shadow to an inset shadow. The preview updates as you make changes, and the box-shadow rule includes the colour in rgba format, ready to copy.

How to use it

  1. 1

    Pick a preset, or set the offset, blur and spread sliders yourself.

  2. 2

    Choose the shadow colour and its alpha, and turn on the inset shadow if you need one.

  3. 3

    Check the preview and copy the box-shadow rule.

If the answer looks wrong

  • No shadow appears.

    The blur and spread may be zero and the colour too transparent. Pick a preset so the values start from somewhere sensible.

  • The colour code is rejected.

    Use a HEX code with three, four, six or eight digits, such as 0f172a or 0f172a80. For transparency use the alpha channel or the last two HEX digits.

  • The shadow spills past the box.

    A negative spread pulls the shadow in, and less blur keeps the edge sharp. If the shadow should only show on one side, adjust the horizontal or vertical offset.

Frequently asked questions

In what order do the box-shadow values go?

Horizontal offset, vertical offset, blur, then spread. The horizontal value moves the shadow right (positive) or left (negative), and the vertical value moves it down or up. Blur softens the edge, and spread grows or shrinks the shadow itself.

Why is the colour written as rgba?

Because a shadow is often partly transparent, and rgba shows the same alpha in every browser. You can paste the rule straight into your CSS; no conversion is needed.

What is an inset shadow for?

An inset shadow falls inside the box and suits pressed buttons, sunken fields and recessed cards. Turning the option on adds the word inset to the start of the value.

Can I stack several shadows?

CSS lets you separate several shadows with commas and stack them, for example a thin edge shadow plus a wide shadow for depth. This tool builds one layer; repeat and combine the output in your own rule.

Does a shadow cost performance?

A simple shadow is usually cheap. Very large shadows with a lot of blur, or animating the blur, can be slow on weak devices; for animation, prefer changing opacity or position over changing blur.