CSS Gradient Generator

Pick a gradient type, list your colours one per line and see the gradient straight away. Copy the CSS line to use it in your styles.

Use the tool

Loading the tool…

About CSS Gradient Generator

Build a CSS gradient. Choose linear, radial or conic, pick the colours and positions, and set the direction or shape, such as centre, circle or ellipse. A preview shows the gradient as you change it, and the CSS is ready to copy.

Worked example

Choose a linear gradient from left to right with two colours. Copy the CSS into your stylesheet.

Limits

Gradients can be hard to read if the colours are close in brightness. Check the contrast of any text placed on top of them.

How to use CSS Gradient Generator

  1. Choose linear, radial or conic, and set the angle, shape or centre where it applies.
  2. List your colours one per line, adding a position such as 40% if you want.
  3. Check the preview and copy the CSS line.

Good to know

  • Colours are hex codes (3, 4, 6 or 8 digits) or the word transparent.
  • Positions must be percentages from 0% to 100% and must not go backwards.
  • For a linear gradient, 0 degrees points up and 90 points right.
  • Conic gradients need a fairly recent browser. Add a plain background colour above the line as a fallback.

Frequently asked questions

How do I make a hard edge?

Give two colours the same position, for example #ff0000 50% and then #0000ff 50%.

Does the angle matter for a radial gradient?

No. A radial gradient uses the shape and centre instead, so the angle is ignored.

Is anything I type saved or sent?

No. The work happens in your browser on this page, and nothing is stored or sent to us.