CSS Gradient Generator

Pick a gradient type, set the colours and where each one sits, and the preview updates as you go. When it looks right, copy the CSS rule and paste it into your stylesheet. Up to five colour stops are supported.

How to use the CSS Gradient Generator

  1. Choose Linear, Radial or Conic.
  2. Set the colours and their positions from 0 to 100 percent. Press Even spacing to spread them out.
  3. For linear and conic gradients set the angle, or pick a direction preset.
  4. Press Copy CSS and paste the rule into your stylesheet.

Angles and stops

In a linear gradient the angle is the direction the colour moves toward: 0deg points up, 90deg points right, 180deg points down and 270deg points left. A gradient from red to blue at 90deg therefore starts red on the left and ends blue on the right.

A colour stop is a colour and a position. With red at 0 percent, yellow at 50 percent and blue at 100 percent, the middle of the box is pure yellow, and the colours between the stops blend smoothly. Two stops at the same position make a hard edge instead of a blend.

Linear, radial and conic

Linear gradients blend along a straight line. Radial gradients blend outward from a centre point in a circle or an ellipse. Conic gradients sweep around the centre like a colour wheel or a pie chart, starting at the angle you set.

All three are plain CSS, supported by current browsers (see the MDN page under Sources), so no image file is needed and the result scales to any size.

Frequently asked questions

Can I use more than two colours?

Yes, up to five. Set each position to decide where it sits.

How do I make a hard edge?

Give two neighbouring colours the same position; there is no blend between them.

Does it work as a text or border colour?

The CSS value works with background and background-image. For text or borders you need extra CSS such as background-clip or border-image.

Does the tool send my colours anywhere?

No. Everything is calculated in your browser.

Sources

Last reviewed