OnlineTextLab
Esc

CSS Gradient Generator

Build linear, radial and conic gradients with a live preview and copy one line of CSS.

Color stops

Runs on your device. Your files and text are not uploaded.

About CSS Gradient Generator

A gradient in CSS needs no image file, scales to any size and loads instantly. The syntax is what slows people down: the angle comes first, stops need positions, and radial and conic forms are written differently. This page lets you adjust it visually and copy the finished declaration.

The preview uses your browser's own CSS engine, showing exactly what the code does in a real page. Start with one of the examples or set your own stops, then paste the line into a stylesheet for a hero section, a button or a card.

How it works

The tool sorts your stops by position and writes standard CSS functions: linear-gradient, radial-gradient or conic-gradient. Direction is written in degrees, where 0 points up and 90 points right. Radial gradients use a shape and a center, and conic ones use a starting angle and a center.

Add a stop and it goes into the middle of the widest gap, using the color the gradient already shows at that point. Nothing visibly changes until you move or recolor it, so you can refine a blend without disturbing it. Placing two stops at one position makes a sharp edge instead of a blend, which is how the Hard stripes example works.

How to use CSS Gradient Generator

  1. Choose Linear, Radial or Conic.
  2. Set the Direction or Starting angle, or the Shape and Center for radial gradients.
  3. Edit the color stops: color, position in percent, or Add a stop. Remove extras with the × button.
  4. Press Copy CSS and paste the line into your stylesheet.

Default blue to teal

Output
background: linear-gradient(135deg, #2563eb 0%, #14b8a6 100%);

Paste this into any rule and it fills the element. The angle of 135 degrees runs from top left to bottom right. Both percent values are explicit, so you can see where each color reaches full strength.

When it helps

  • A hero background that scales to any screen without an image request.
  • A subtle tint on a card or a section divider.
  • A pie or donut shape built from hard stops in a conic gradient.
  • Stripes for a progress bar or a warning label, using hard stops.

Tips for a better result

  • Check text contrast at both ends of a gradient. Readable at the light end can mean unreadable at the dark end.
  • Two close hues usually look better than two distant ones. Distant colors can go gray in the middle.
  • Add one stop between two distant colors to steer the blend away from muddy midpoints.
  • Set a plain background-color before the gradient as a fallback, so the text stays readable if the gradient does not load as expected.

Good to know

  • It writes one gradient at a time. CSS can layer several in a single background, but you would need to combine them by hand.
  • Repeating gradients and interpolation color spaces such as in oklch are not generated, though you can add them to the copied code.
  • Stop colors are written in hex, without transparency. To fade to transparent, edit the copied line by hand.
  • It does not produce an image file. If a platform only accepts images, take a screenshot of the preview.

Questions people ask

What does the angle in linear-gradient mean?

It is the direction the gradient travels: 0deg goes upward, 90deg to the right, 180deg downward. The first color starts at the opposite end.

How do I make a hard edge rather than a blend?

Give two stops the same position with different colors. Try the Hard stripes example, which has black and yellow both at 50 percent.

Do all browsers support conic gradients?

All current major browsers do, and so do versions from the last several years. Linear and radial gradients have been supported for far longer.

Is a gradient better for speed than an image?

Usually yes. It is a few bytes of CSS rather than a file to download, and it stays sharp at every size and screen density.

What to use next

Last reviewed . Read our editorial policy.