Tailwind Gradient Generator

Build linear or radial gradients with up to 8 color stops, then copy the Tailwind v3 config, CSS fallback, or HTML

Gradient Controls

Preview

Tailwind class: bg-gradient-custom

Color Stops

tailwind.config.js (backgroundImage)
CSS Fallback
HTML Usage

What is a Tailwind Gradient Generator?

Tailwind CSS v3 ships with a small set of built-in gradient utilities: bg-gradient-to-* for eight preset directions, and from-*, via-*, and to-* for at most three color stops. That is enough for simple fades, but it cannot express more than three colors or an arbitrary angle such as 135deg.

This generator fills that gap. It lets you place up to eight color stops, set any angle from 0 to 360 degrees, or switch to a radial gradient with a custom shape, size, and center point. The result is written as a reusable backgroundImage entry in tailwind.config.js, together with a plain CSS fallback and an HTML usage example you can copy right away.

How to Use This Generator

  1. Choose a gradient type — Linear or Radial. Only the controls for that type are shown.
  2. Set the geometry — pick a direction or drag the custom angle for linear, or choose shape, size, and center for radial.
  3. Add and position colors — click + Add Stop and use each row's color picker and position slider. Minimum 2 stops, maximum 8.
  4. Reorder or remove stops — the up and down arrows change the order, the remove button deletes a stop.
  5. Preview live — every change updates both previews and all code panels immediately.
  6. Copy the output — copy the Tailwind v3 config, plain CSS, or HTML usage with one click.

Example: Custom Gradient in tailwind.config.js

The example below registers two gradients: a four-stop linear gradient at 135deg, and a radial gradient with a custom center. Both go inside theme.extend.backgroundImage, and each key becomes a class name.

// tailwind.config.js
module.exports = {
  content: ['./resources/**/*.{html,js,php}'],
  theme: {
    extend: {
      backgroundImage: {
        'gradient-custom': 'linear-gradient(135deg, #3b82f6 0%, #8b5cf6 35%, #ec4899 70%, #f59e0b 100%)',
        'gradient-radial': 'radial-gradient(circle farthest-corner at 50% 0%, #ffffff 0%, #bfdbfe 45%, #1e3a8a 100%)',
      },
    },
  },
};

Use the keys directly as utilities. The class name is bg- plus the key, so gradient-custom becomes bg-gradient-custom.

<div class="rounded-xl bg-gradient-custom p-8 text-white">
  Custom gradient background
</div>

<div class="rounded-full bg-gradient-radial p-8 text-blue-950">
  Radial gradient
</div>

After saving the config, restart your dev server so Tailwind picks up the new entries.

Gradient Settings Reference

Setting Range / Options Effect
TypeLinear, RadialSelects whether the output uses linear-gradient() or radial-gradient().
Direction8 presets: to top, to top right, to right, to bottom right, to bottom, to bottom left, to left, to top leftSets the gradient line with a preset keyword. Each preset maps to a fixed angle.
Custom Angle0–360 degreesSets any gradient line angle, such as 135deg. Use this when the eight presets are not enough.
ShapeCircle, Ellipse (radial only)Controls whether the radial gradient expands as a circle or an ellipse.
SizeClosest side, closest corner, farthest side, farthest corner (radial only)Controls how far the gradient extends from its center point.
Position X / Y0–100% each (radial only)Moves the center point of the radial gradient.
Color Stops2–8 stops, each with a color and a 0–100% positionDefines the colors and where each one appears along the gradient.

Built-in Utilities vs Custom Gradient

Feature Built-in utilities (Tailwind v3) Custom gradient (this tool)
Color stopsUp to 3 (from, via, to)Up to 8
Angle control8 preset directionsAny angle from 0 to 360 degrees
Radial gradientsNot availableYes, with shape, size, and position
Config requiredNoYes, one backgroundImage entry (or CSS)

Tips and Common Mistakes

  • Restart or rebuild after changing tailwind.config.js. A running dev server may keep the old theme until it restarts.
  • Make sure the page file is included in content. Tailwind scans those paths, so a missing file means the class is purged from the build.
  • Do not use too many stops. Two to four colors are usually enough; extra stops can create muddy transitions and banding.
  • Check text contrast over the gradient. Test the lightest and darkest areas, and add an overlay if the text is hard to read.
  • Keep the CSS fallback. Use it for browsers or projects that do not run Tailwind, or when the generated utility class is not available.

FAQ

How do I add a custom gradient to Tailwind CSS?

Add it under theme.extend.backgroundImage in tailwind.config.js, then use the key as a class name. The example above shows the full config and usage.

Can I use more than three color stops in Tailwind?

The built-in v3 utilities stop at from, via, and to, which means three colors. This tool supports up to 8 stops through a custom config.

How do I set a custom gradient angle like 135deg?

Set the Custom Angle slider, then copy the generated config. The built-in classes only cover the eight preset directions.

Does Tailwind support radial gradients?

Not with the built-in v3 utilities. This tool generates a radial-gradient() with the shape, size, and position you choose.

Why isn't my custom gradient class working?

Common causes: the config has not been rebuilt, the class name does not match the config key, or the template file is not included in the content paths.

Is this compatible with Tailwind CSS v4?

This tool generates the Tailwind v3 tailwind.config.js format. Tailwind v4 uses CSS-first configuration by default, so use the CSS fallback or adapt the output according to the Tailwind documentation.

What is the CSS fallback for?

Use it in projects that do not use Tailwind, or as a fallback when the utility class is not available.

Is my data sent to a server?

No. Everything is processed locally in your browser; nothing is uploaded or stored.