Xerobit

Text Gradient Generator: Create CSS Gradient Text

Use this text gradient generator to create CSS code that applies a color gradient to any text element. Choose between linear and radial gradients, set your angle, pick two or more colors, and copy the generated CSS instantly. Everything runs in your browser so nothing is uploaded anywhere.

Result

Gradient Text
.gradient-text {
  background: linear-gradient(90deg, #ff0000, #0000ff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
  • Background
    linear-gradient(90deg, #ff0000, #0000ff)
  • Colors used
    #ff0000, #0000ff
  • Type
    Linear
  • Angle
    90deg

How to use the css text gradient generator

  1. Type your desired preview text into the first field.
  2. Select Linear or Radial as the gradient type.
  3. Set the angle in degrees if you chose a linear gradient.
  4. Enter two to four CSS color values (hex codes, rgb, or named colors).
  5. Copy the generated CSS from the output area and paste it into your stylesheet.

How CSS gradient text works

A gradient text css generator relies on three specific CSS properties working together. First, background defines the gradient itself using either linear-gradient() or radial-gradient(). Second, -webkit-background-clip: text clips that background so it only paints behind the actual letterforms of the element. Third, -webkit-text-fill-color: transparent makes the default text fill invisible, allowing the clipped background to show through.

The -webkit- prefix is kept in the output because older versions of Safari and Chrome only understood background-clip: text with it. Current browsers also accept the unprefixed form, and this tool writes both.

Linear vs radial gradients

When you use this html gradient text generator, you can choose between two gradient shapes. A linear gradient transitions colors along a straight line defined by an angle. An angle of 0 degrees points upward, 90 degrees points right, 180 degrees points down, and 270 degrees points left. The formula inside the CSS looks like this:

linear-gradient(90deg, #ff0000, #0000ff)

A radial gradient transitions colors outward from a central point in a circular or elliptical shape. The angle parameter does not apply to radial gradients. Instead, the colors radiate from the center of the text element outward to its edges:

radial-gradient(circle, #ff0000, #0000ff)

Both approaches use the same clipping technique to restrict the color to the text itself.

Common color formats supported

You can pass any valid CSS color string into the fields of this gradient text generator. Here are the most common formats:

FormatExampleNotes
Hex (6-digit)#ff5733Most widely used for web design
Hex (3-digit)#f00Shorthand for #ff0000
RGBrgb(255, 0, 0)Good for programmatic generation
RGBArgba(255, 0, 0, 0.8)Adds alpha transparency
HSLhsl(120, 100%, 50%)Intuitive for adjusting lightness
Named colorstomato, rebeccapurple148 standard CSS color names

Always test your chosen colors for contrast. Because the text fill becomes transparent, the gradient itself must provide enough contrast against the page background to remain readable.

Accessibility considerations

While a text gradient css generator produces visually striking results, gradient text can reduce readability for users with visual impairments. Low-contrast color combinations make text difficult to parse, especially at small font sizes.

To maintain accessibility, ensure your gradient colors have sufficient contrast against the page background. Avoid using subtle gradients on body copy; reserve them for large headings where the letterforms are thick enough to display the color transition clearly. You should also verify that the text remains legible when Windows High Contrast Mode or macOS Increase Contrast settings are enabled, as these operating system features may override your CSS.

Browser support and fallbacks

The background-clip: text property is supported in all modern browsers including Chrome, Firefox, Safari, and Edge. Because older versions still need the -webkit- prefix, include both the prefixed and unprefixed declarations in your CSS, as this tool does.

If you need to support very old browsers that do not understand background-clip: text, the text will simply render with a solid background box behind it. To prevent this, you can use a feature query (@supports) to apply the gradient only when the browser supports the clipping behavior, falling back to a solid color otherwise.

For developers working within utility-first frameworks, our tailwind gradient generator provides a similar workflow tailored specifically for Tailwind CSS classes rather than raw CSS properties.

Worked examples

ExampleInputResult
Red to blue linearPreview text: Hello World; Gradient type: linear; Angle (degrees): 90; Color 1: #ff0000; Color 2: #0000ffBackground: linear-gradient(90deg, #ff0000, #0000ff); Colors used: #ff0000, #0000ff; Type: Linear; Angle: 90deg
Rainbow diagonalPreview text: Rainbow; Gradient type: linear; Angle (degrees): 45; Color 1: #ff0000; Color 2: #ffff00; Color 3 (optional): #00ff00; Color 4 (optional): #0000ffBackground: linear-gradient(45deg, #ff0000, #ffff00, #00ff00, #0000ff); Colors used: #ff0000, #ffff00, #00ff00, #0000ff; Type: Linear; Angle: 45deg
Radial sunsetPreview text: Sunset; Gradient type: radial; Angle (degrees): 90; Color 1: #ff7e5f; Color 2: #feb47bBackground: radial-gradient(circle, #ff7e5f, #feb47b); Colors used: #ff7e5f, #feb47b; Type: Radial

FAQ

What is a text gradient generator?

A text gradient generator is a tool that writes the CSS needed to apply a color gradient to HTML text. It outputs the background, background-clip, and text-fill-color properties so you can paste them directly into your stylesheet.

Why does the generated CSS include -webkit- prefixes?

Older versions of Safari and Chrome only clip a background to text with -webkit-background-clip: text. The -webkit-text-fill-color: transparent line hides the normal fill so the gradient shows through. Current browsers accept the unprefixed background-clip too, and the output contains both.

Can I use more than two colors in my gradient?

Yes. This gradient text css generator accepts up to four color stops. You can enter hex codes, RGB values, HSL values, or standard CSS color names in each field.

Does the angle setting work for radial gradients?

No. The angle parameter only applies to linear gradients, where it controls the direction of the color transition. Radial gradients expand outward from the center of the element in a circle, so an angle is not applicable.

Is this html gradient text generator free to use?

Yes. The tool runs entirely in your browser, generates standard CSS, and requires no account or payment. No data is sent to any server.

Will gradient text affect my SEO or screen readers?

No. Screen readers read the underlying HTML text content, not the CSS styling. Search engines also index the text normally. The gradient is purely a visual enhancement applied via CSS.