CSS text gradient generator

A CSS text gradient fills the letters with a background gradient using background-clip: text and a transparent text fill. Type your headline below, set the colors and direction, then copy CSS that includes a solid-color fallback.

A CSS text gradient fills the letters with a background gradient using background-clip: text. Type your headline, set the font size, colors, stops and direction, then copy CSS that includes a solid-color fallback.

How to use the generator

  1. Type the headline you want to style, or start from a preset and press Reverse colors to swap the stops.
  2. Set the font size, the gradient direction in degrees, and each color stop with its position from 0% to 100%.
  3. Preview the result on a light or dark background, check the contrast note, then press Copy CSS.

Need a background to sit behind the text? Build one with the CSS gradient generator, then paste the same colors here.

0deg runs bottom to top, 90deg left to right. Arrow keys nudge by 1deg.

Gradient headline

Your CSS

.gradient-text {
  color: #4f46e5;
}

@supports (background-clip: text) or (-webkit-background-clip: text) {
  .gradient-text {
    background-image: linear-gradient(90deg, #4f46e5 0%, #ec4899 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
  }
}

What does the copied CSS do?

The output has two parts. The first rule sets a solid color from your first stop, which is the fallback. The second rule sits inside @supports and only runs in browsers that understand background-clip: text. It applies the linear-gradient as a background-image, clips that background to the letters, and makes the text fill transparent so the gradient shows through. Both the -webkit- prefixed and standard properties are included for Safari and older WebKit browsers.

Which browsers support gradient text, and what is the fallback?

background-clip: text is supported in current Chrome, Edge, Safari and Firefox. Older browsers and some email clients ignore it, and without a fallback the transparent text fill can make the headline disappear. That is why the copied CSS declares a solid color first and puts the clipped gradient inside @supports. If a browser cannot clip text, visitors still see readable solid text in the first stop color.

Is gradient text accessible and readable?

A gradient changes color across the word, so a single contrast reading cannot validate the whole headline. Check the lightest and darkest points of the gradient against the background where the text sits. WCAG AA asks for at least 3:1 for large text and 4.5:1 for normal text. Keep gradient text on short headings, avoid pale stops on white, and use the color contrast checker to test the exact stop colors. The generator warns when either stop falls below 3:1 on the preview background.

Study typography on real interfaces

See how live products treat headlines, gradients and type hierarchy, then bring the colors back here.

Frequently asked questions

How do you make gradient text in CSS?

Give the text a background gradient, then clip that background to the shape of the letters with background-clip: text and make the text fill transparent. In practice you set background-image to a linear-gradient, add -webkit-background-clip: text and background-clip: text, then set -webkit-text-fill-color: transparent. The gradient only shows through the glyphs, so the text itself looks filled with color.

Why do I need -webkit-background-clip: text?

Safari and some older WebKit browsers only understand the prefixed property, so -webkit-background-clip: text keeps gradient text working there. Modern Chrome, Edge and Firefox support the unprefixed background-clip: text. Ship both lines together: the prefixed one first, the standard one second, so each browser uses the property it understands.

What is a solid-color fallback for gradient text?

A fallback is a normal color declared before the clipped version, so the text stays visible if a browser does not support background-clip: text. This generator wraps the gradient rule in @supports (background-clip: text) or (-webkit-background-clip: text) and sets color to the first stop outside it. Browsers without support show readable solid text instead of invisible or unstyled text.

Is gradient text accessible?

Gradient text can be accessible, but the contrast changes across the word, so check the lightest and darkest points of the gradient against the background. Large text needs at least 3:1 contrast and normal text needs 4.5:1 under WCAG AA. Keep the gradient on short headings rather than body copy, avoid low-contrast pastel stops on white, and make sure the same information is available as plain text for screen readers.

Does background-clip: text work with any font?

Yes, it works with any web font or system font because it clips to the rendered glyphs rather than the font file. Very thin weights and small sizes can lose detail, so gradient text usually reads best on bold headings at 32px or larger. If a font fails to load, the fallback color still keeps the text readable.

More CSS generators

Color tools

Image tools

Image & SVG tools

Typography & units

More free tools

All free tools