Market
Pricing
Sign inStart
Field GuideCSS and web
CSS and web

Tailwind gradient text: classes, v4 syntax and fixes

Four utilities turn a heading into gradient text. The details around them decide whether it looks crisp or clipped. Here are the classes for Tailwind v4 and v3, and the problems you will hit.

GradientlyVerified Gradiently account·October 1, 2026·5 min read
Cover: Storm Telegram · GR·N1EC·8E

The short version

  • Tailwind gradient text needs a gradient background, bg-clip-text to clip it to the letters, and text-transparent so the background shows through.
  • In Tailwind v4 the gradient utility is bg-linear-to-r, while v3 uses bg-gradient-to-r; the from, via and to colour classes work the same in both.
  • Tailwind v4 lets you choose the interpolation space with a modifier such as bg-linear-to-r/oklch, which keeps the midpoint of a gradient bright.
  • Add box-decoration-clone when a gradient heading wraps onto several lines, and a little bottom padding when descenders get cut off.
  • Check the contrast of the lightest colour in the gradient against the page, because that is where gradient text becomes hard to read.
On this page
How the classes work togetherTailwind v4 and v3 class namesGradient text examples you can copyFixing common gradient text problemsAnimating Tailwind gradient textKeep gradient text readable

To make Tailwind gradient text, put a gradient on the element and clip it to the letters: bg-linear-to-r from-violet-600 to-pink-500 bg-clip-text text-transparent. The first part paints a gradient background, bg-clip-text trims that background to the shape of the glyphs, and text-transparent removes the solid text colour so the gradient shows through. In Tailwind v3, write bg-gradient-to-r instead of bg-linear-to-r; the rest is identical.

html
<h1 class="bg-linear-to-r from-violet-600 to-pink-500 bg-clip-text text-5xl font-bold text-transparent">
  Ship the quiet version
</h1>
The whole effect in one class list. Order inside the class attribute does not matter.

How the classes work together

It helps to know what each utility compiles to, because every bug with gradient text comes from one of the four parts going missing. Under the hood this is the same technique as plain CSS gradient text: background-clip: text with a transparent fill.

bg-linear-to-r

What it sets

A linear gradient towards the right

If you forget it

No gradient at all
from-* via-* to-*

What it sets

The colour stops

If you forget it

Transparent or default stops
bg-clip-text

What it sets

background-clip: text

If you forget it

A coloured box behind solid text
text-transparent

What it sets

color: transparent

If you forget it

Solid text covers the gradient
UtilityWhat it setsIf you forget it
bg-linear-to-rA linear gradient towards the rightNo gradient at all
from-* via-* to-*The colour stopsTransparent or default stops
bg-clip-textbackground-clip: textA coloured box behind solid text
text-transparentcolor: transparentSolid text covers the gradient
The four parts of Tailwind gradient text and the symptom each one leaves when it is missing.

Directions follow the usual suffixes: -to-r, -to-br, -to-b and so on. Version 4 also accepts an angle, such as bg-linear-45 or bg-linear-135, and adds bg-radial and bg-conic, which work for text too. If you have not used the gradient utilities much, Tailwind gradients covers backgrounds in depth.

Tailwind v4 and v3 class names

The biggest change in v4 is the name of the linear utility. bg-gradient-to-r became bg-linear-to-r, to sit alongside the new radial and conic utilities. The old name still compiles in v4 for compatibility, but new code should use the new one.

Left to right

Tailwind v4

bg-linear-to-r

Tailwind v3

bg-gradient-to-r
Diagonalbg-linear-to-br or bg-linear-45

Tailwind v3

bg-gradient-to-br
Radialbg-radial

Tailwind v3

Arbitrary value only
Conicbg-conic

Tailwind v3

Arbitrary value only
OKLCH blending

Tailwind v4

bg-linear-to-r/oklch

Tailwind v3

Not available
Clip to text

Tailwind v4

bg-clip-text

Tailwind v3

bg-clip-text
What you wantTailwind v4Tailwind v3
Left to rightbg-linear-to-rbg-gradient-to-r
Diagonalbg-linear-to-br or bg-linear-45bg-gradient-to-br
Radialbg-radialArbitrary value only
Conicbg-conicArbitrary value only
OKLCH blendingbg-linear-to-r/oklchNot available
Clip to textbg-clip-textbg-clip-text
Side by side, so you can tell which version a snippet you found online was written for.

Gradient text examples you can copy

Three or four colours that sit near each other on the wheel make the cleanest gradient text. Opposites look loud and can turn grey in the middle. These combinations use colours from the default palette, described in Tailwind colours.

Each label lists the stops in order: the first goes in from-*, a middle one in via-*, the last in to-*. The 600 shades keep enough contrast on a white page; on a dark page, swap to 300 or 400. The hex values are the v3 palette; v4's OKLCH versions look very close.

Stop positions move where each colour sits. from-20% via-50% to-80% keeps solid colour at both ends of a long headline, which looks calmer than a blend that starts on the first letter.

html
<!-- Stop positions -->
<h2 class="bg-linear-to-r from-cyan-600 from-20% via-blue-600 via-50% to-violet-600 to-80% bg-clip-text text-transparent">
  Plans for every team
</h2>

<!-- OKLCH interpolation keeps the middle bright -->
<h2 class="bg-linear-to-r/oklch from-blue-600 to-yellow-400 bg-clip-text text-transparent">
  Brighter in the middle
</h2>

<!-- Arbitrary gradient, underscores stand in for spaces -->
<h2 class="bg-[linear-gradient(100deg,#1e1b4b_0%,#7c3aed_60%,#f472b6_100%)] bg-clip-text text-transparent">
  Exactly your colours
</h2>
Stop positions, an interpolation modifier and a fully custom gradient. Arbitrary values work in v3 and v4.

Blue to yellow is a good test of interpolation. Blended in sRGB it passes through a greyish green; blended in OKLCH it stays vivid. CSS gradients in OKLCH explains why.

Fixing common gradient text problems

Multi-line headings

By default the gradient spans the whole element box, so a heading that wraps gets one stretched gradient with the second line in a different colour from the first. Add box-decoration-clone to give each line its own full gradient, or inline-block to shrink the box to the text.

Clipped descenders

Tight leading such as leading-none can slice the bottom off a g or y, because the background ends at the line box. Add pb-1 or loosen the leading slightly.

Dark mode

A gradient tuned for white paper looks muddy on a dark page. Give it its own shades with variants: from-violet-600 to-pink-600 dark:from-violet-300 dark:to-pink-300. The same thinking applies to backgrounds, covered in dark mode gradients.

Avoid

  • Gradient text on long paragraphs
  • A pale stop that vanishes on white
  • Complementary colours with a grey middle
  • Gradient text on top of a gradient background
  • Leaving out a solid colour for selected text

Do

  • Keep it for a headline or a single word
  • Check the lightest stop against the page
  • Neighbouring hues, or OKLCH interpolation
  • Solid ground behind gradient words
  • Set selection:text-white selection:bg-violet-600

Animating Tailwind gradient text

A slow shimmer comes from a background twice as wide as the text that slides sideways. In v4, define the animation inside @theme and it becomes an animate-* utility.

css
@import "tailwindcss";

@theme {
  --animate-shine: shine 6s linear infinite;

  @keyframes shine {
    to { background-position: 200% center; }
  }
}
Then add bg-size-[200%_auto] animate-shine motion-reduce:animate-none to the heading, and repeat the first colour as the last stop so the loop has no jump.

Use it once on a page at most. Motion pulls the eye, which is the point for a launch headline and a nuisance everywhere else. The pattern is the same one used in animated CSS gradients.

Keep gradient text readable

  1. 1

    Find the weakest stop

    The lightest colour on a light page, or the darkest on a dark page, sets the contrast you actually get.

  2. 2

    Test it like body copy

    Large bold headings need at least 3:1 against the page under WCAG. Colour contrast and accessibility has the full rules.

  3. 3

    Use weight

    Gradients read better in bold and heavy weights, where there is more fill to show the colour.

  4. 4

    Stop at a few words

    One headline or one emphasised word. Anything longer starts to look like a rendering error.

Gradient text is a web technique. When the job is a social post or a banner and you want the gradient behind the words instead, Gradiently Marks move their calmest area behind the text and pick light or dark ink per line, so the words read without you testing every stop.

Design with a living gradient

Posts, stories, slides and banners in every size, with text that always reads.

Start designing, free

Questions people ask

How do I make gradient text in Tailwind?

Add a gradient with bg-linear-to-r (or bg-gradient-to-r in v3), colour stops with from-* and to-*, then bg-clip-text and text-transparent.

Why is my Tailwind gradient text not showing?

Usually text-transparent is missing, so solid text covers the gradient, or bg-clip-text is missing, so the gradient fills a box behind the words. Check that all four parts are on the same element.

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

The linear utility is now bg-linear-to-r. The old name still works for compatibility, and v4 adds bg-radial, bg-conic and angle utilities such as bg-linear-45.

How do I stop gradient text cutting off letters like g and y?

Add a little bottom padding such as pb-1, or loosen the line height, because the clipped background ends at the line box.

Is gradient text accessible?

It can be, if every part of the gradient meets contrast requirements against the page. Test the lightest stop and keep gradient text to headings.

Share this guide

Written by GradientlyVerified Gradiently account

The team behind Gradiently, a design tool built around Marks: living gradients that make everything you design look like yours.

See our profile

On this page

How the classes work togetherTailwind v4 and v3 class namesGradient text examples you can copyFixing common gradient text problemsAnimating Tailwind gradient textKeep gradient text readable

Share this guide

Next in CSS and web

Tailwind colours: using and extending the palette

Keep reading

All CSS and web guides
CSS and web

Gradient text in CSS, done well

5 min read

Three lines of CSS put a gradient inside your letters. Making it readable, robust and tasteful takes a few more, and knowing when to leave the text plain.

CSS and web

Tailwind gradient classes: linear, radial and conic in v4

5 min read

Tailwind v4 renamed its gradient utilities, added angles, radial and conic gradients, and switched the default blend to oklab. Here is the whole system, with the CSS each class produces.

CSS and web

Tailwind colours: using and extending the palette

5 min read

The default palette is a good starting point and a poor finishing one, because thousands of sites share it. Here is how Tailwind colours work in v4, and how to add your own without breaking anything.

Find the look that’s only yours.

Every Mark is a living background with one owner. Try an unclaimed Mark, and claim yours when it feels right.

Start designing

Check a certificate

Type a certificate number or a Mark’s code to see who owns it.

Works with ChatGPT and Claude

Ask your AI for a design. It makes it in your Mark, ready to edit.

ChatGPTClaude
How to connect

Product

  • Market
  • Explore
  • Pricing
  • Certificates

Learn

  • Field Guide
  • Help centre
  • What’s new

Developers

  • Overview
  • ChatGPT and Claude
  • API reference
  • API keys

Company

  • About
  • Contact us
  • Sign in

Legal

  • Terms
  • Privacy
  • Refunds
  • Mark protection
  • Cookies
  • All policies
Move through the letters. Each one wears a real Mark.Touch a letter to see its Mark.One name. Ten Marks inside it.
© 2026 Gradiently