CSS Gradient Generator

Make a linear, radial, or conic gradient, see it update as you go, and copy the CSS or Tailwind classes. Drag the color stops to change the blend. Everything runs in your browser.

Color stops

Click the bar to add a color. Drag a handle to move it, or use the arrow keys.

Stop 1 of 3

Type a HEX code or pick a color.

Position
0%
Opacity
100%
Gradient type
Direction
Angle
Write the direction as
Color blending
Presets
background: linear-gradient(90deg, #6366f1 0%, #ec4899 50%, #f59e0b 100%);

What is a CSS gradient?

A CSS gradient is an image the browser draws from code by blending two or more colors. Because it counts as an image, you set it with the background or background-image property, not background-color.

There are three kinds: linear-gradient(), radial-gradient(), and conic-gradient(). Each takes a list of color stops, which are colors with a position such as #6366f1 0%. Gradients stay sharp at any size and add no image file for the page to download.

Why use our CSS gradient generator

  • ·Free. No signup, no paywall, no limits.
  • ·Runs in your browser. Nothing gets uploaded, and the preview updates instantly.
  • ·All three gradient types. Linear, radial, and conic, plus repeating versions of each.
  • ·Drag and drop color stops. Add as many colors as you like and move them with a mouse, a finger, or the arrow keys.
  • ·Smoother blends. Optional OKLab and OKLCH blending, with a fallback line for older browsers.
  • ·CSS or Tailwind. Copy plain CSS, or classes for Tailwind v4 or v3.

How to make a CSS gradient

  1. 1

    Pick a gradient type

    Choose Linear for a straight blend, Radial for a blend that spreads out from a point, or Conic for a blend that sweeps around a point.

  2. 2

    Set the colors

    Click a handle on the color bar, then pick a color or type a HEX code. Click anywhere on the bar to add another color, or start from one of the presets.

  3. 3

    Adjust the direction and spacing

    Drag the angle slider or click an arrow to change the direction. Drag the handles, or use the Position slider, to change where each color starts.

  4. 4

    Copy the code

    Choose CSS, Tailwind v4, or Tailwind v3 under the preview and click the copy button. Paste the CSS into your stylesheet, or the Tailwind classes into your HTML.

CSS gradient generator options

Linear gradient

Colors blend along a straight line. Set any angle from 0 to 359 degrees, or click an arrow for one of the eight common directions.

CSS
.hero {
  background: linear-gradient(
    90deg,
    #6366f1 0%,
    #f59e0b 100%
  );
}

Radial gradient

Colors spread out from a center point as an ellipse or a circle. Move the center to one of nine spots, such as the top left corner.

CSS
.spotlight {
  background: radial-gradient(
    circle at top left,
    #6366f1 0%,
    #f59e0b 100%
  );
}

Conic gradient

Colors sweep around a center point like the hands of a clock. Good for color wheels and pie chart shapes. You can set the starting angle and the center.

CSS
.wheel {
  background: conic-gradient(
    from 90deg,
    #6366f1 0%,
    #f59e0b 100%
  );
}

Repeating gradients

Turn on Repeat the pattern and the colors start again after the last stop. With the last stop at 20%, the pattern repeats five times. Put two stops at the same spot for hard stripes.

CSS
.stripes {
  background: repeating-linear-gradient(
    45deg,
    #6366f1 0%,
    #6366f1 10%,
    #f59e0b 10%,
    #f59e0b 20%
  );
}

Color blending

Standard blending mixes colors in sRGB, which turns gray between opposite colors like blue and yellow. OKLab and OKLCH keep the middle bright. The CSS adds an sRGB fallback line for older browsers.

CSS
.blend {
  /* Fallback for older browsers */
  background: linear-gradient(
    90deg,
    #0000ff 0%,
    #ffff00 100%
  );
  background: linear-gradient(
    90deg in oklab,
    #0000ff 0%,
    #ffff00 100%
  );
}

Transparent colors

Lower a stop's opacity to fade into whatever is behind it, such as a photo. See-through stops are written as rgba() so the opacity is easy to read.

CSS
.photo-overlay {
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.6) 0%,
    rgba(0, 0, 0, 0) 100%
  );
}

CSS gradient angles and directions

The angle in a linear gradient is the direction the colors travel. 0deg points up, and the angle turns clockwise from there. If you leave the angle out, the gradient runs from top to bottom. You can also write a direction as a keyword:

AngleKeywordColors run
0degto topBottom to top
90degto rightLeft to right
180degto bottomTop to bottom (the default)
270degto leftRight to left
45degto top right (only on a square box)Bottom left to top right

Corner keywords like to top right aim at the corner of the box, so on a wide box they are not the same as45deg. Under Write the direction as, pick Degrees for a direction that stays the same on any box shape, or Keyword when the gradient should always run corner to corner.

Common CSS gradient problems and how to fix them

The middle of the gradient looks gray

Browsers mix gradient colors in sRGB unless you say otherwise. Halfway between blue (#0000ff) and yellow (#ffff00) that mix is #808080, a flat gray. Set Color blending to Smooth (OKLab), or add a bright color in the middle as a third stop.

The page background gradient repeats or stops partway down

A gradient on the body is sized to the page content. On a short page it ends early and repeats to fill the window. Make the page at least as tall as the window:

Make the page fill the windowCSS
html {
  min-height: 100%;
}

You want a sharp line instead of a fade

Give two stops the same position. The color changes at that point with no blend. In this tool, select a stop and set its Position slider to match its neighbor.

Two stops at 50%CSS
.split {
  background: linear-gradient(
    90deg,
    #6366f1 50%,
    #f59e0b 50%
  );
}

You want the gradient on text

Paste the gradient as the background, clip it to the text, and make the text color transparent so the gradient shows through:

Gradient headline
Gradient textCSS
h1 {
  background: linear-gradient(90deg, #6366f1 0%, #f59e0b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

The gradient will not animate with a transition

Browsers cannot blend from one background-image to another, so a transition between two gradients switches instantly. Make the gradient wider than the element with background-size and animate background-position instead. Or put the second gradient on a ::before layer and fade its opacity.

Hover me
Slide the gradient on hoverCSS
.button {
  background: linear-gradient(90deg, #6366f1, #ec4899, #f59e0b);
  background-size: 200% 100%;
  transition: background-position 0.4s ease;
}

.button:hover {
  background-position: 100% 0;
}

You can see bands or steps in a smooth gradient

Most screens show 256 levels for each of red, green, and blue. When two very similar colors are stretched across a large area, the steps between those levels can show up as bands. Use colors that are further apart, or lay a faint noise texture over the gradient.

Who uses a CSS gradient generator

  • ·Web developers. Build page backgrounds, hero sections, buttons, and image overlays without an image file.
  • ·Designers. Turn a gradient from a mockup into code by matching its colors, angle, and stop positions.
  • ·Tailwind CSS users. Get gradient classes with any angle, or a single class when you need more than three colors.
  • ·People learning CSS. See how each setting changes the gradient syntax, line by line.

Frequently asked questions

How do I make a CSS gradient?
Pick Linear, Radial, or Conic, then set your colors on the color bar. Change the angle or center point until the preview looks right, then click Copy CSS and paste the line into your stylesheet. It sets the background property, so it works on any element.
How do I add or remove colors in a gradient?
Click anywhere on the color bar to add a color at that spot. The new color matches the gradient at that point, so the look does not jump. To remove a color, select its handle and click Remove, or press Delete. A gradient needs at least two colors.
What is the difference between linear, radial, and conic gradients?
A linear gradient blends colors along a straight line, like from left to right. A radial gradient spreads colors out from a center point in rings. A conic gradient sweeps colors around a center point, like the hands of a clock.
How do I make a gradient that fades to transparent?
Select the stop you want to fade and drag its Opacity slider down to 0%. The CSS writes that stop as rgba() with an alpha of 0. A dark color fading to transparent is a common way to make text readable on top of a photo.
Why is the middle of my gradient gray or muddy?
By default, browsers mix gradient colors in the sRGB color space. Halfway between opposite colors, like blue and yellow, that mix lands on gray. Set Color blending to Smooth (OKLab) to keep the middle bright, or add a third color in the middle yourself.
Does OKLab and OKLCH blending work in every browser?
Current versions of Chrome, Edge, Firefox, and Safari support it. Older browsers ignore a line they cannot read, so the copied CSS starts with a standard sRGB line. Those browsers use that line and newer ones use the second.
How do I use the gradient with Tailwind CSS?
Pick the Tailwind v4 or Tailwind v3 tab and copy the classes. When Tailwind's own gradient classes can make your gradient, you get those, such as bg-linear-90/srgb from-[#6366f1] to-[#f59e0b] in v4. Otherwise you get one bg-[...] class. Both versions have only three color slots (from, via, and to) and no repeating gradients. v3 also only points to a side or corner, with no angles, radial, conic, or OKLab blending, so it falls back to the bg-[...] class more often.
Why does the Tailwind class end in /srgb?
Tailwind v4 blends gradient colors in OKLab by default, while plain CSS blends in sRGB. The /srgb ending tells Tailwind to use sRGB, so the result matches the preview when Color blending is set to Standard. Pick Smooth (OKLab) and the ending goes away.
Should I write the angle in degrees or as a keyword like to right?
Under Write the direction as, pick Degrees or Keyword. Straight keywords are exactly the same as their angle, so to right equals 90deg. Corner keywords are different: to top right aims at the corner, so on a wide box it is flatter than 45deg. Use degrees for an exact angle, and a corner keyword when the gradient should always run corner to corner. Only the eight arrow directions have keywords, so Keyword is turned off for any other angle.
What does Repeat the pattern do?
It switches to repeating-linear-gradient, repeating-radial-gradient, or repeating-conic-gradient. The colors repeat after the last stop, so you only see a change once the last stop is below 100%. It is the usual way to make stripes, rings, and checker-like patterns in CSS.
Is the CSS gradient generator free and private?
Yes. It is free with no signup, and everything runs in your browser. Nothing you make is sent to a server.