Tailwind CSS Gradient Generator

Beautiful gradients instantly styled with Tailwind CSS. Pick your colors, preview in real UI components, and copy the code — all in one place.

Gradient Settings

Gradient colors

Linear gradient direction

Tailwind CSS UI Elements

Tailwind CSS Gradient Text

Tailwind CSS Code Snippet

<h1 class="bg-gradient-to-r from-[#b80f5e] bg-clip-text text-transparent"></h1>
Like the button style? Press to see Tailwind CSS styling

No Animation Buttons

Background Filled Buttons

Animated Slide Buttons

Tailwind CSS Code Snippet

<button class="relative cursor-pointer rounded border-2 border-transparent bg-white bg-clip-padding px-5 py-2 text-sm font-semibold after:absolute after:-inset-0.5 after:-z-10 after:rounded after:bg-gradient-to-r after:from-[#b80f5e] after:content-['']"></button>

Tailwind CSS gradient background

Tailwind CSS Gradient background

Tailwind CSS Code Snippet

<div class="bg-gradient-to-r from-[#b80f5e]"></div>

How to Generate a Tailwind CSS Gradient

  1. Pick your colors — choose 2 or 3 gradient colors using the color pickers above. The first color maps to from-, the optional middle color to via-, and the last color to to-.
  2. Set the direction — select a gradient direction like left to right (bg-gradient-to-r), top to bottom (bg-gradient-to-b), or diagonal.
  3. Preview in real components — see the gradient applied to text, buttons, and background sections instantly.
  4. Copy the classes — click the copy button on any preview to get the complete Tailwind CSS class string ready to paste into your markup.

How Tailwind CSS Gradients Work

Tailwind CSS provides utility classes for building linear gradients without writing custom CSS. The system uses three components: a direction class (bg-gradient-to-r, bg-gradient-to-b, etc.), a starting color (from-blue-500), an optional middle color (via-purple-500), and an ending color (to-pink-500).

Under the hood, Tailwind compiles these classes into a standard CSS linear-gradient() with the specified direction and color stops. The via- class adds a middle color stop at 50%, creating smoother three-color transitions. You can use any Tailwind color or arbitrary values like from-[#ff7e5f] for custom hex colors.

Gradient Text in Tailwind CSS

To apply a gradient to text in Tailwind, combine the gradient classes with bg-clip-text and text-transparent. This clips the gradient background to the shape of the text and hides the original text color, making the gradient visible through the letterforms. The full class string looks like: bg-gradient-to-r from-[#color1] to-[#color2] bg-clip-text text-transparent.

This technique works in all modern browsers. Keep in mind that gradient text can be harder to read at small sizes, so it works best for headings, hero text, and display typography rather than body copy.

Gradient Buttons in Tailwind CSS

Apply gradient classes directly to a button element for a gradient background. For hover effects, Tailwind lets you modify gradient colors on hover — for example, hover:from-blue-600 hover:to-purple-600 darkens the gradient on interaction. Pair gradients with rounded-lg, shadow-lg, and text-white for polished, production-ready buttons.

Frequently Asked Questions

How do I create a gradient in Tailwind CSS?
Use the direction class (bg-gradient-to-r) with color stops (from-blue-500 to-purple-500). Tailwind compiles this into a CSS linear-gradient(). You can also add a middle color with via-.
Can I use custom colors with Tailwind gradients?
Yes. Use arbitrary value syntax: from-[#ff7e5f] to-[#feb47b]. This accepts any valid CSS color — hex, rgb, hsl, or named colors. This generator outputs these arbitrary value classes automatically based on the colors you pick.
How do I apply a gradient to text in Tailwind?
Add bg-clip-text text-transparent alongside your gradient classes. This makes the text transparent and clips the background gradient to the text shape, creating the gradient text effect.
What does via do in Tailwind gradients?
The via- class adds a middle color stop at 50% between the from- and to- colors. Without it, the gradient transitions directly between two colors. With it, you get a smoother three-color gradient.

More Gradient Tools

Not quite the right gradient? Discover more

Lavender Skies

Color codes used in lavender skies gradient: #9b58b6, #a7c7e7, #cfaee0

Cotton Candy Dream

Color codes used in cotton candy dream gradient: #f8b4d8, #f2cfdf, #a7c7e7

Vivid Twilight

Color codes used in vivid twilight gradient: #b80f5e, #681b98, #4051b5

Vivid Twilight

Color codes used in vivid twilight gradient: #b80f5e, #681b98, #3949ac

Rose Sunset

Color codes used in rose sunset gradient: #b80f5e, #d1478c, #f28cae

Subtle Environment

Color codes used in subtle environment gradient: #a9d6bb, #f0e3cb, #d3c0b1

Serene Forest

Color codes used in serene forest gradient: #609087, #a2c3b9, #d5e2dc

Sunlit Forest

Color codes used in sunlit forest gradient: #7b9d88, #a8944d, #dcb041
Explore more gradients