How to use the box shadow generator
- Start from a preset such as Subtle, Large, Smooth (layered), Glow or Neumorphism.
- Adjust the selected layer with the offset, blur, spread and opacity sliders, or type exact pixel values.
- Use Add layer to stack shadows. Real-world shadows usually look best with two or more layers: a tight one for contact and a wide, soft one for depth.
- Change the background, box color and corner radius to match your design, then copy the CSS or the Tailwind class.
The box-shadow syntax
box-shadow: [inset] offset-x offset-y blur spread color;
- Offset X and Y move the shadow right and down. Negative values move it left and up.
- Blur softens the edge. Zero gives a hard, flat shadow.
- Spread grows or shrinks the shadow before blurring. A negative spread keeps a large blur from showing at the sides.
- Color is usually black or a dark tint of your brand color at low opacity, so the shadow takes on the hue of the page.
- inset draws the shadow inside the element, for pressed buttons and input fields.
Several shadows are separated by commas and drawn in order, with the first one on top.
Tips for natural shadows
- Keep opacity low (5–20%) and use layers instead of one dark shadow.
- Use the same light direction everywhere: if cards cast shadows downwards, dropdowns and dialogs should too.
- Larger elevation means a larger offset and blur. Dialogs float higher than cards, and cards higher than buttons.
- Animate
box-shadowsparingly. For hover effects on many items, atransformwith a fixed shadow is cheaper to render.
Bootstrap and Tailwind CSS
Bootstrap 5 ships shadow-sm, shadow and shadow-lg; paste a custom value into your own class or the --bs-box-shadow variables. Tailwind CSS accepts the generated arbitrary value, for example shadow-[0_8px_30px_rgba(0,0,0,0.12)]. See shadows in context in our card components.