Gradient Generator

Build a CSS gradient and copy the rule.

About Gradient Generator

A CSS gradient generator for linear and radial gradients with two to ten colour stops. Set the direction and stops, preview it and copy the background rule.

How to use

  1. Switch between Linear and Radial. Linear offers a direction (to right, to left, to bottom, to top, to bottom right, or a custom angle in degrees); radial offers the centre point (centre, top, bottom, left or right).
  2. Set each stop's colour and its position as a percentage. Add stop inserts a white stop in the middle of the widest gap, up to ten; a stop can be removed while more than two remain.
  3. The preview and the CSS update as you edit. Copy the rule, or download it as gradient.css.

Options

  • Colours are six-digit hex values, or eight digits to include alpha; the rule is withheld until every stop is valid.
  • Positions run from 0 to 100% and are sorted before the rule is written, so stop order in the list does not matter.
  • Radial gradients are always circular (circle at <position>).
  • Default: linear, to right, #FF0000 at 0% to #0000FF at 100%.

The tool does not produce conic or repeating gradients.

Example

Linear · To right · #FF0000 0% · #0000FF 100%
→ background: linear-gradient(to right, #FF0000 0%, #0000FF 100%);

Privacy

The rule is built in the browser. No request is made, and nothing is stored.

Frequently asked questions

What is the difference between a linear and a radial gradient in CSS?
A linear gradient changes colour along a straight line in one direction, such as left to right or at 45 degrees. A radial gradient starts at a centre point and changes colour outward in circles or ellipses.
What do the percentages in a CSS gradient mean?
Each percentage is a colour stop: the point along the gradient line where that colour is fully shown. Between two stops the browser blends the colours; before the first and after the last stop the colour is solid.
Why does "to right" mean the same as 90deg?
CSS angles for linear-gradient start at the top and increase clockwise, so 0deg points up, 90deg points right and 180deg points down. The keyword forms are easier to read, while degrees allow any angle.