Quick answer

<!-- Tailwind CSS v4 -->
<div class="bg-linear-to-r from-indigo-500 via-purple-500 to-pink-500"></div>

<!-- Tailwind CSS v3 -->
<div class="bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500"></div>

Use bg-radial and bg-conic (v4) for radial and conic gradients, and add a modifier like /oklch to change how colors blend.

Linear gradients in Tailwind v4

In v4, linear gradients use bg-linear-to-* with a direction: t, tr, r, br, b, bl, l or tl. You can also use any angle with bg-linear-<angle>, for example bg-linear-45, or a negative angle with -bg-linear-45.

<div class="h-48 rounded-2xl bg-linear-to-br from-indigo-950 via-purple-700 to-rose-500"></div>
<div class="h-48 rounded-2xl bg-linear-45 from-sky-400 to-indigo-600"></div>
bg-linear-to-br from-indigo-950 via-purple-700 to-rose-500

Color stops: from, via and to

Colors are set with from-*, via-* and to-*, using any color in your theme or an arbitrary value like from-[#0b1030]. Add a position to any stop to control where it sits:

<div class="bg-linear-to-r from-indigo-500 from-10% via-sky-500 via-30% to-emerald-500 to-90%"></div>

Opacity modifiers work on stops too, which is handy for overlays on photos:

<div class="bg-linear-to-t from-black/70 to-transparent"></div>

Radial and conic gradients (v4)

v4 added first-class radial and conic utilities. Use bg-radial for a centered radial gradient, or pass a position as an arbitrary value:

<div class="bg-radial from-amber-200 via-orange-500 to-indigo-950"></div>
<div class="bg-radial-[at_25%_25%] from-white to-zinc-900 to-75%"></div>
bg-radial-[at_25%_25%] from-amber-200 via-orange-500 to-indigo-950

Conic gradients use bg-conic with an optional starting angle such as bg-conic-180:

<div class="size-48 rounded-full bg-conic-180 from-cyan-400 via-purple-500 to-cyan-400"></div>

Interpolation: oklab, oklch and srgb

Tailwind v4 blends gradients in OKLab by default, which keeps transitions vivid. You can change the color space with a modifier on the gradient utility:

<div class="bg-linear-to-r/srgb from-blue-600 to-amber-500"></div>  <!-- classic sRGB blend -->
<div class="bg-linear-to-r/oklch from-blue-600 to-amber-500"></div> <!-- travels through the hue wheel -->

OKLCH can produce more saturated, rainbow-like transitions because it moves through hues, while sRGB gives the old, sometimes duller look. Hue interpolation modifiers let you control the direction around the color wheel as well.

Arbitrary values and custom gradients

When the utilities are not enough, write the gradient yourself:

<div class="bg-[linear-gradient(135deg_in_oklab,#1e1b4b,#7e22ce_55%,#f43f5e)]"></div>

Underscores stand for spaces in arbitrary values. For gradients you reuse often, define them once in your CSS and reference them with a utility, so your markup stays readable.

Tailwind v3 syntax

WhatTailwind v4Tailwind v3
Linear to the rightbg-linear-to-rbg-gradient-to-r
Linear at an anglebg-linear-45Arbitrary value only
Radialbg-radialArbitrary value only
Conicbg-conicArbitrary value only
Color stopsfrom-* via-* to-*from-* via-* to-*
Default blendingOKLabsRGB

Upgrading from v3? Rename bg-gradient-to-* to bg-linear-to-*; the color stop utilities stay the same.

Gradient text

<h1 class="bg-linear-to-r from-purple-500 via-rose-500 to-amber-400 bg-clip-text text-transparent">
  Gradient headline
</h1>

Combine bg-clip-text with text-transparent. Keep it for large headlines; small gradient text is hard to read.

Add grain or use a gradient image

Tailwind gradients are smooth CSS gradients, so they share the same limits: no grain, no organic mesh shapes. Layer a grain or gradient image underneath your content for a richer look:

<section class="relative overflow-hidden bg-indigo-950">
  <img src="/gradient.webp" alt="" class="absolute inset-0 size-full object-cover" />
  <div class="relative">…</div>
</section>
Sky Indigo, a grainy sky blue to indigo gradient
A gradient image with grain behind your Tailwind layout gives depth that utility gradients cannot.

Frequently asked questions

What replaced bg-gradient-to-r in Tailwind v4?

bg-linear-to-r. All bg-gradient-to-* utilities were renamed to bg-linear-to-*, and v4 adds angle utilities like bg-linear-45 plus bg-radial and bg-conic.

How do I set color stop positions in Tailwind?

Add a percentage utility after each stop, for example from-indigo-500 from-10% via-sky-500 via-30% to-emerald-500 to-90%.

Which color space does Tailwind v4 use for gradients?

OKLab by default. Use a modifier like /srgb or /oklch on the gradient utility to change it.

How do I make gradient text in Tailwind?

Add a gradient background plus bg-clip-text and text-transparent to the text element.