Tailwind CSS Shadow Generator
Visually create box-shadow values, find the closest Tailwind class, and get copy-ready CSS or config
CSS (Cascading Style Sheets) is the language used to style and layout web pages. It controls colors, fonts, spacing, positioning, animations, and responsive design. CSS separates presentation from content, allowing the same HTML to look completely different with different stylesheets. Modern CSS includes powerful features like Flexbox, Grid, custom properties, and media queries.
Drag sliders for offset, blur, spread, and color — the live preview updates instantly so you stop guessing at box-shadow numbers. The tool matches your shadow to the closest Tailwind utility class, gives you raw CSS, and generates a tailwind.config.js snippet ready to paste. And everything runs in your browser. Nothing gets uploaded.
How It Works
You set offset-x, offset-y, blur, spread, color, and opacity with sliders. The preview card updates instantly using inline CSS. Behind the scenes, the tool compares your values against Tailwind's built-in shadow scale to find the closest match. If nothing fits well, it generates a config snippet you can drop into tailwind.config.js — ready to go.
Examples
Subtle Card Elevation
A pricing card that needs just enough lift to separate from the background.
x: 0 y: 1 blur: 3 spread: 0
color: #000000 opacity: 0.10
class="shadow"
box-shadow: 0 1px 3px 0 rgba(0,0,0,0.10);
Modal Dialog with Heavy Shadow
You want a modal overlay that clearly floats above everything else. Two layers give depth without looking flat.
Layer 1: x:0 y:20 blur:25 spread:-5 opacity:0.10
Layer 2: x:0 y:8 blur:10 spread:-6 opacity:0.10
class="shadow-xl"
box-shadow: 0 20px 25px -5px rgba(0,0,0,0.10),
0 8px 10px -6px rgba(0,0,0,0.10);
Colored Glow for a CTA Button
Purple glow behind a call-to-action button. No built-in Tailwind class covers this — you need a config entry.
x: 0 y: 0 blur: 15 spread: 3
color: #6366f1 opacity: 0.30
// tailwind.config.js
boxShadow: {
'glow': '0 0 15px 3px rgba(99,102,241,0.30)'
}
// Usage: class="shadow-glow"
Who Uses This
Grab the exact Tailwind class or config snippet instead of guessing shadow-md vs shadow-lg.
Visually dial in elevation and depth for cards, modals, and dropdowns before handing off to dev.
Quickly match client mockup shadows to Tailwind classes without trial-and-error in the browser.
See how offset, blur, spread, and opacity interact in real time — better than reading docs.
Common Mistakes
A 40px blur with x:0 and y:0 creates an even glow on all sides — it looks like an error, not elevation. Add at least 4-8px of y-offset so the shadow sits below the element like a real light source.
Shadows above 0.25 opacity on a white background look harsh and dated. Tailwind's own classes top out around 0.10. Stay in the 0.05–0.15 range for natural-looking depth.
Spread shrinks or expands the shadow shape. Negative spread pulls the edges inward, which keeps large-blur shadows from bleeding past the element. Most of Tailwind's built-in shadows use negative spread — skip it and your custom shadow will look wider than intended.
Technical Details
- Processing: 100% client-side — vanilla JavaScript, no frameworks
- Shadow Layers: Unlimited — add as many as you need
- Output Formats: Tailwind class, raw CSS, tailwind.config.js snippet
- Browser Support: Chrome, Firefox, Safari, Edge
- Offline Capable: Yes, after initial page load
Frequently Asked Questions
What shadow classes come with Tailwind CSS?
Tailwind ships with shadow-sm, shadow, shadow-md, shadow-lg, shadow-xl, and shadow-2xl. There's also shadow-inner for inset shadows and shadow-none to strip shadows entirely. Each one maps to a specific box-shadow value with tuned offsets and opacity.
How do I add a custom shadow to my Tailwind config?
Open tailwind.config.js and add your value under theme.extend.boxShadow. Give it a name like "custom" and set the value to a CSS box-shadow string. Then use class="shadow-custom" in your HTML. This tool generates that exact snippet for you — just copy and paste.
What is the difference between box-shadow and drop-shadow in Tailwind?
The shadow- classes apply CSS box-shadow, which draws a rectangular shadow around the element's box. The drop-shadow- classes use filter: drop-shadow(), which follows the element's actual shape — great for transparent PNGs and SVGs. This generator works with box-shadow values only.
Can Tailwind handle multi-layer shadows?
Absolutely. CSS box-shadow takes comma-separated layers, and Tailwind's own shadow-lg and shadow-xl already use two layers each. For custom multi-layer shadows, define them as a single comma-separated string in your config. The generator builds that string automatically when you add layers.
Does this shadow generator work offline?
Yes. Once the page has loaded, all calculations happen in your browser with plain JavaScript. Nothing is sent to a server. You can disconnect from the internet and keep tweaking shadows — the preview, matching, and code output all still work.