CSS box shadow generator
Build a shadow with up to four layers, check it on a light or dark surface, then copy it as plain CSS or as a Tailwind class. Free, and nothing leaves your browser.
CSS
box-shadow:
0px 20px 40px -26px rgb(0 0 0 / 35%),
0px 0px 0px 1px rgb(0 0 0 / 5%);Tailwind CSS
shadow-[0px_20px_40px_-26px_rgb(0_0_0_/_35%),0px_0px_0px_1px_rgb(0_0_0_/_5%)]
Questions
- How do I use a box shadow in Tailwind CSS?
- Copy the Tailwind line from the generator and put it in your class list, for example shadow-[0_20px_40px_-26px_rgb(0_0_0_/_35%)]. Tailwind turns the underscores into spaces. For a shadow you reuse, add it to your theme as a named shadow instead.
- What do the offset, blur and spread values do?
- The two offsets move the shadow right and down (negative values move it left and up). Blur softens its edge. Spread makes the shadow bigger or smaller than the element before blurring, and a negative spread is how soft, lifted shadows keep tight to the box.
- Why do good shadows use more than one layer?
- Real shadows have a sharp part close to the object and a wide soft part further away. One layer cannot do both, so most polished interfaces stack two: a thin, faint outline or contact shadow, and a large, low-opacity one.
- What does inset do?
- An inset shadow is drawn inside the element instead of outside, which makes it look pressed in. It is used for inputs, toggles and pressed buttons.
- Does box-shadow affect performance?
- A large blur on many elements can be costly to paint, and animating box-shadow forces repaints. If you animate a shadow, fade the opacity of a pseudo-element that holds the larger shadow instead.
Want shadows that move? Browse the card components or see how we build a Tailwind bento grid.