CSS Gradient Generator

Create linear, radial and conic CSS gradients visually. Add color stops, set the angle and position, and copy the CSS or Tailwind CSS classes.

Gradient type
Color stops
Presets
CSS

                        
Tailwind CSS (arbitrary value)
Tailwind CSS classes
v4
v3

Create CSS Gradients Visually

Gradients add depth to buttons, hero sections, cards and backgrounds, but writing the CSS by hand is fiddly. This CSS gradient generator lets you build linear, radial and conic gradients with a live preview, then copy clean code.

Add as many color stops as you like, move them, set the angle or position and start from a preset. You get the CSS background, a Tailwind CSS arbitrary value that works with any gradient, and ready-made Tailwind CSS v3 and v4 classes when the gradient allows it.

Gradient colors turned into CSS code#4F46E5linear-gradient()CSS GradientGenerator

How to create a CSS gradient

  1. Choose a type: Linear, Radial or Conic. Or click a preset to start.
  2. Set the colors. Change each color stop with the color square or by typing a value (HEX, RGB, HSL or OKLCH, including transparent colors). Set where each stop sits with its percentage.
  3. Adjust the angle or position. Add or remove stops until the preview looks right.
  4. Copy the code: plain CSS, the Tailwind arbitrary value, or the Tailwind v4 / v3 classes.

Linear, radial and conic gradients

TypeHow the colors changeExample
LinearAlong a straight line at an angle. 90deg runs left to right, 180deg top to bottom.linear-gradient(90deg, #4F46E5 0%, #EC4899 100%)
RadialOutwards from a point, as a circle or ellipse.radial-gradient(circle at center, #6366F1 0%, #0F172A 100%)
ConicAround a center point, like a color wheel or pie chart.conic-gradient(from 0deg at center, red, yellow, lime, aqua, blue, magenta, red)

Color stops, hard edges and transparency

  • Positions: each color stop has a position from 0% to 100%. Moving two stops closer makes the transition sharper.
  • Hard edges and stripes: give two stops the same position, for example #4F46E5 50%, #EC4899 50%, for a crisp line with no blending.
  • Fades: use a transparent color such as rgba(79, 70, 229, 0) as the last stop to fade an image or section into the background.
  • Avoid a gray middle: blending complementary colors (for example blue and yellow) can create a dull middle. Add a middle stop, or use modern CSS interpolation: linear-gradient(in oklch 90deg, blue, yellow).

Gradients in Tailwind CSS

Tailwind CSS v3Tailwind CSS v4
Linear, left to rightbg-gradient-to-r from-indigo-600 to-pink-500bg-linear-to-r or bg-linear-90 with the same from/to
Any angleArbitrary value onlybg-linear-135
Middle colorvia-purple-500via-purple-500
Stop positionsfrom-10% via-30% to-90%Same
Radial and conicArbitrary value onlybg-radial, bg-conic-180
Anything elsebg-[linear-gradient(90deg,#4f46e5_0%,#ec4899_100%)] (spaces become underscores)

See more examples in the Tailwind gradient docs.

Gradient text and borders

To fill text with a gradient, set it as the background and clip it to the text:

background: linear-gradient(90deg, #4F46E5 0%, #EC4899 100%); -webkit-background-clip: text; background-clip: text; color: transparent;

In Tailwind CSS: bg-gradient-to-r from-indigo-600 to-pink-500 bg-clip-text text-transparent. Keep enough contrast with the background: check both end colors with the contrast checker.

Frequently Asked Questions

Common questions about CSS gradients.

Use a gradient function as the background, for example background: linear-gradient(90deg, #4F46E5 0%, #EC4899 100%);. The generator above writes this for you.

Linear gradients change color along a straight line, radial gradients spread out from a point, and conic gradients rotate around a center point like a color wheel.

Use an angle (90deg is left to right, 180deg top to bottom) or keywords such as to right or to bottom right.

As many as you like. Click Add color stop to add more. Tailwind’s from/via/to classes support up to three, but the arbitrary value works with any number.

Copy the Tailwind CSS classes (v4 or v3) when they are shown, or the arbitrary value such as bg-[linear-gradient(90deg,#4f46e5_0%,#ec4899_100%)], which works with every gradient.

Yes. Type a transparent color such as rgba(255, 255, 255, 0) or #FFFFFF00 for a color stop.

Linear and radial gradients work in all browsers. Conic gradients work in all current versions of Chrome, Edge, Firefox and Safari.