Tailwind CSS Shadow Generator

Build and preview Tailwind CSS shadow utility classes visually. Customize shadow size, color, direction, and opacity. Copy Tailwind classes or raw CSS instantly.

How to use Tailwind CSS Shadow Generator

  1. 1

    Choose a shadow size preset (sm, md, lg, xl, 2xl, inner).

  2. 2

    Optionally set a shadow color from the Tailwind palette.

  3. 3

    Adjust opacity with the opacity modifier.

  4. 4

    Preview on sample card and button elements.

  5. 5

    Copy the Tailwind shadow classes.

Frequently Asked Questions

What is the difference between shadow and drop-shadow in Tailwind?

shadow-* uses CSS box-shadow applied to the element bounding box. drop-shadow-* is a CSS filter that respects element transparency — useful for SVGs and PNGs.

How do I add colored shadows in Tailwind?

Use shadow-{color}/{opacity} syntax alongside a shadow size: class="shadow-lg shadow-blue-500/50". Only works with Tailwind v3.1+.

Can I use custom shadow values?

Yes. Use arbitrary values: shadow-[0_20px_60px_rgba(0,0,0,0.3)], or define custom shadows in your tailwind.config.js under theme.extend.boxShadow.

Detailed Guide

Shadows in Tailwind CSS

Shadows are one of the most effective ways to create visual hierarchy — they tell users which elements are elevated (modals, cards, dropdowns) and which are flat (body content). Tailwind CSS includes a complete shadow system with 8 built-in sizes plus drop-shadow filter utilities.


Built-in Shadow Classes

Tailwind's box-shadow utilities:

ClassEffect
shadow-smSubtle, soft shadow — cards, inputs
shadowDefault shadow — buttons, links
shadow-mdMedium shadow — hover states on cards
shadow-lgLarge shadow — modals, floating elements
shadow-xlExtra large — overlays, drawers
shadow-2xlDramatic shadow — prominent call-to-actions
shadow-innerInset shadow — pressed buttons, inputs
shadow-noneRemove all shadows

Colored Shadows (Tailwind v3.1+)

One of the most powerful additions to Tailwind's shadow system is colored shadows:

<!-- Blue shadow on hover -->
<button class="bg-blue-500 shadow-lg shadow-blue-500/50 hover:shadow-blue-500/80">
  Click me
</button>

The shadow-{color}/{opacity} syntax lets you match shadow color to element color, creating that premium "glow" effect used on CTAs and gradient buttons.


Drop Shadow vs Box Shadow

Tailwind has two separate shadow systems:

shadow-* (box-shadow): Applied to the element's bounding box. Works on rectangles, ignores transparency.

drop-shadow-* (filter): Applied as a CSS filter — it respects the actual shape of the element, including transparent areas. Essential for icons, PNG images with transparent backgrounds, and SVGs.

<!-- Box shadow on a card -->
<div class="shadow-lg rounded-2xl">

<!-- Drop shadow on a logo SVG -->
<img class="drop-shadow-lg" src="/logo.svg" />

Creating Custom Shadows

For shadows beyond Tailwind's presets, use arbitrary values:

<div class="shadow-[0_20px_60px_rgba(0,0,0,0.3)]">

Or define custom shadows in your tailwind.config.js:

module.exports = {
  theme: {
    extend: {
      boxShadow: {
        'brand': '0 4px 24px -4px rgba(9, 43, 85, 0.5)',
        'card-hover': '0 20px 40px -8px rgba(0, 0, 0, 0.2)',
      }
    }
  }
}

Shadow Best Practices

Use shadows to imply elevation, not decoration. Elements higher in the visual stack should have larger shadows. Reserve shadow-2xl for things that truly float above the page (modals, tooltips).

**Pair shadow size ...

Looking for a more detailed deep-dive and advanced tips?

Read Full Article on our Blog