Tools

Home
JSON FormatterSQL FormatterJS ValidatorMinify CSS
Merge PDFCompress PDFImage to PDF
JPG to PNGPNG to WebPCrop Image

Tailwind CSS Gradient Generator

Build beautiful gradients with Tailwind CSS classes and live preview

Your files never leave your browser
Ready
Gradient ready·to-r

Preset Gradients

Pick a direction, select your Tailwind palette colors, and see the gradient update live — then copy the exact utility classes or raw CSS straight into your project. No more flipping between docs to remember if it's from-, via-, or to-, or squinting at hex values that don't match the shade you actually wanted.

The preset gallery gives you a head start with popular combinations you can tweak from there. And everything runs in your browser. Nothing gets uploaded.

How It Works

Pick Direction & Colors
→
Live Preview Updates
→
Copy Classes or CSS

You select a gradient direction (like to-r for left-to-right), then pick From, Via, and To colors from Tailwind's palette. The tool builds the correct class string — bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500 — and generates the equivalent CSS background-image property at the same time. One click copies either version.

Examples

Sunset Hero Banner

A warm left-to-right gradient for a landing page header section.

INPUT
Direction: to-r From: orange-400 Via: rose-500 To: purple-600
OUTPUT
bg-gradient-to-r from-orange-400 via-rose-500 to-purple-600

Dark Mode Card Background

Subtle diagonal gradient for a card component in a dark UI. Two stops only — no via color needed.

INPUT
Direction: to-br From: slate-800 To: gray-900
OUTPUT
bg-gradient-to-br from-slate-800 to-gray-900

CTA Button Gradient

Eye-catching gradient for button backgrounds on a SaaS pricing page. The CSS output works if you are not using Tailwind in that particular project.

INPUT
Direction: to-r From: cyan-400 Via: blue-500 To: indigo-600
OUTPUT
bg-gradient-to-r from-cyan-400 via-blue-500 to-indigo-600 CSS: background-image: linear-gradient(to right, #22d3ee, #3b82f6, #4f46e5);

Who Uses This

👨‍💻 Frontend Developers

Building Tailwind components and want the exact class string without checking docs every time.

🎨 UI Designers

Prototyping color schemes and handing off correct Tailwind classes to devs.

📚 Students

Learning Tailwind's gradient syntax by seeing how direction and color stops map to classes.

🚀 Indie Hackers

Shipping landing pages fast and grabbing gradient code without slowing down.

Common Mistakes

Forgetting the base gradient class

Adding from-blue-500 to-green-500 without bg-gradient-to-r does nothing. The direction class is what enables the gradient — color stops alone won't show anything.

Using "via" when you only want two colors

A via color adds a middle stop. If you want a simple blue-to-green blend, skip via entirely. Adding it creates a three-stop gradient that might look muddy or unexpected.

Picking shades too close together

Going from blue-400 to blue-500 produces a gradient that looks like a solid color. Spread your shades apart — at least 200-300 difference — or use different color families for visible contrast.

Technical Details

Frequently Asked Questions

How do I make a gradient in Tailwind CSS?

Add bg-gradient-to-{direction} to your element, then set color stops with from-{color}, optionally via-{color}, and to-{color}. For example, bg-gradient-to-r from-blue-500 to-green-400 gives you a left-to-right blue-to-green gradient. The direction part is required — without it, the color stops do nothing.

What does "via" do in a Tailwind gradient?

The via class adds a middle color stop to your gradient. So from-red-500 via-yellow-500 to-green-500 blends from red through yellow to green. Without via, you get a direct two-color blend. It is completely optional — most simple gradients don't need it.

Can I use custom colors in Tailwind gradients?

Yes. In Tailwind v3+, you can write from-[#ff6b6b] using arbitrary value syntax. This generator sticks to the built-in palette so the output stays readable, but you can swap in custom hex values in your own code without any config changes.

How do I make a diagonal gradient in Tailwind?

Use one of the corner directions: bg-gradient-to-br (top-left to bottom-right), bg-gradient-to-bl, bg-gradient-to-tr, or bg-gradient-to-tl. These map to CSS values like to bottom right. The generator lets you click a direction and see the result right away.

Is this gradient generator free to use?

Completely free, no signup, no limits. The tool runs in your browser so there's nothing to pay for. Use it as many times as you want — for personal projects, client work, whatever. The generated code is yours.

Share: