Tailwind Gradient Generator

Build beautiful CSS and Tailwind gradients visually. Choose direction, from/via/to colors and get Tailwind classes or raw CSS instantly. Supports all Tailwind color shades.

How to use Tailwind Gradient Generator

  1. 1

    Choose gradient direction (to-r, to-br, to-b, etc.).

  2. 2

    Pick a "from" starting color and shade from the Tailwind palette.

  3. 3

    Optionally add a "via" middle color for a three-stop gradient.

  4. 4

    Pick a "to" ending color.

  5. 5

    Copy the generated Tailwind classes or raw CSS.

Frequently Asked Questions

How do I make a gradient in Tailwind?

Use background gradient direction class (bg-gradient-to-r), then add from-{color}, optionally via-{color}, and to-{color} utility classes.

Can I use custom colors in Tailwind gradients?

Yes. Use Tailwind's arbitrary value syntax: from-[#092B55] to-[#F49449] for any hex color.

Does Tailwind support animated gradients?

Not natively, but you can add custom @keyframes in your tailwind.config.js and use background-position animation with background-size: 200% to achieve the effect.

Detailed Guide

Gradients in Tailwind CSS

CSS gradients went from a nice-to-have to a core part of modern UI design. They add depth, dimension, and visual interest without images — and they scale perfectly to any screen size.

Tailwind CSS v3 ships with a complete gradient system based on utility classes. Instead of writing raw CSS gradient syntax (which is surprisingly verbose), you compose gradients from three simple building blocks.


How Tailwind Gradients Work

Tailwind's gradient system uses three key classes:

Direction: bg-gradient-to-{direction}

  • bg-gradient-to-r — left to right
  • bg-gradient-to-br — top-left to bottom-right
  • bg-gradient-to-b — top to bottom
  • And 5 more directional variants (t, tl, tr, l, bl, bl)

Color stops:

  • from-{color} — starting color
  • via-{color} — optional middle color
  • to-{color} — ending color

Example: A purple-to-pink gradient:

<div class="bg-gradient-to-r from-purple-500 to-pink-500">

Three-stop gradient:

<div class="bg-gradient-to-r from-blue-500 via-purple-500 to-pink-500">

Tailwind Color Palette for Gradients

Tailwind includes 22 color families (slate, gray, zinc, neutral, stone, red, orange, amber, yellow, lime, green, emerald, teal, cyan, sky, blue, indigo, violet, purple, fuchsia, pink, rose), each with 11 shades from 50 to 950.

That's thousands of possible color combinations. Popular gradient pairings include:

NameClasses
Oceanfrom-blue-500 to-teal-400
Sunsetfrom-orange-500 via-red-500 to-pink-500
Aurorafrom-green-400 via-teal-500 to-blue-600
Cotton Candyfrom-pink-300 to-violet-400
Midnightfrom-gray-950 to-slate-800
Goldfrom-yellow-400 to-orange-500

Custom Colors with Arbitrary Values

Tailwind's arbitrary value syntax lets you use any hex color in gradients:

<div class="bg-gradient-to-r from-[#092B55] to-[#F49449]">

This bridges the gap between Tailwind's palette and your brand colors.


Animating Gradients with Tailwind

Tailwind doesn't include gradient animation utilities by default, but you can add custom @keyframes in your config and use animate-* classes:

@keyframes gradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

Combined with background-size: 200% on the gradient div, this creates the popular animated gradient background...

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

Read Full Article on our Blog