About the Gradient Generator
Build a CSS gradient by eye and copy the code when it looks right. The gradient maker handles linear, radial and conic colour gradients with two to eight colour stops, and the preview follows every drag. What you copy is a ready-to-paste background line for buttons, hero sections, cards and page backgrounds.
Pick each colour, slide it to a position between 0% and 100%, and set the angle for linear and conic gradients. Reset Parameters returns to the starting indigo-to-pink diagonal.
How the CSS is built
Colour stops are sorted by position before the code is written, so the order you add them in doesn't matter, and each stop becomes a colour followed by its position. A new stop starts in blue at the average position of the stops you already have, ready to be moved.
Linear gradients use the angle slider from 0 to 360°: 0deg runs from bottom to top, 90deg from left to right and 180deg from top to bottom. Radial gradients are written as a circle spreading from the centre, so the angle slider is hidden. Conic gradients sweep the colours round the centre, starting at the chosen angle, and each position is turned from a percentage into degrees.
linear: linear-gradient(<angle>deg, <colour> <position>%, …)
radial: radial-gradient(circle, <colour> <position>%, …)
conic: conic-gradient(from <angle>deg, <colour> <position × 3.6>deg, …)
e.g. 25% → 90deg, 50% → 180deg, 100% → 360degTwo stops at the same position give a hard edge instead of a blend. That is how stripes, split backgrounds and pie-chart style conic gradients are made.
Assumptions and limits
- Between 2 and 8 colour stops; positions are whole percentages and the angle moves in 1-degree steps.
- The colour boxes give solid colours. For a fade to transparent, edit the copied code and use a colour with alpha, such as rgba(99, 102, 241, 0) or the 8-digit hex #6366f100.
- Radial gradients are always a centred circle; for an ellipse or an off-centre spot, change circle to, for example, ellipse at top left in the copied code.
- The result is CSS code, not an image file. Very old browsers without conic-gradient support ignore that line, so add a plain background-color line before it as a fallback.
Worked examples
The default diagonal
Two stops, indigo at 0% and pink at 100%, on a 135° linear gradient run from the top left corner to the bottom right. This is the code the tool copies:
background: linear-gradient(135deg, #6366f1 0%, #ec4899 100%);
A three-colour sunset for a hero section
Set the angle to 180°, add a stop, and use orange at 0%, pink at 50% and indigo at 100% for a top-to-bottom sky that suits white headline text.
background: linear-gradient(180deg, #f97316 0%, #ec4899 50%, #6366f1 100%);
A quarter-filled conic progress ring
Choose Conic, set the angle to 0° and press + Add Stop twice to get four stops: green at 0% and 25%, light grey at 25% and 100%. Stops that share a position keep the order they appear in the list, so make the upper of the two 25% rows green. The repeated 25% makes a sharp edge, so a quarter of the circle is green, like a 25% progress indicator. Round the corners of the element with border-radius: 50% to make it a circle.
background: conic-gradient(from 0deg, #22c55e 0deg, #22c55e 90deg, #e5e7eb 90deg, #e5e7eb 360deg);
Linear gradient angles and their direction
| Angle | Colour runs from | To |
|---|---|---|
| 0deg | Bottom | Top |
| 45deg | Bottom left | Top right |
| 90deg | Left | Right |
| 135deg | Top left | Bottom right |
| 180deg | Top | Bottom |
| 270deg | Right | Left |
How to use the Gradient Generator
- Choose a gradient type. Click Linear, Radial or Conic at the top of Gradient Parameters.
- Set the colours. Click a swatch to choose its colour, drag its slider to position it, use + Add Stop for up to 8 stops, and move Gradient Angle for linear or conic.
- Copy the CSS. Press Copy Code under the live preview and paste the background line into your stylesheet or an element's style.
Frequently asked questions
How do I make a gradient background in CSS?
Set the element's background to a gradient function, for example background: linear-gradient(90deg, #6366f1 0%, #ec4899 100%);. Build the look here with the sliders, press Copy Code, and paste the line into the CSS rule for your section, button or body.
What is the difference between linear, radial and conic gradients?
A linear gradient changes colour along a straight line at the angle you set. A radial gradient spreads outwards in rings from the centre. A conic gradient changes colour around the centre like the hands of a clock, which makes it useful for colour wheels, pie charts and progress rings.
How do I make a hard line instead of a smooth blend?
Give two neighbouring stops the same position, such as blue at 50% and white at 50%. The colour then switches instantly at that point. Repeating the pattern with more stops at matching positions creates stripes or flags.
Can a gradient fade to transparent?
Yes, but you add the transparency in the code. Copy the CSS and replace the end colour with one that has an alpha value, such as rgba(255, 255, 255, 0) or #ffffff00. This is handy for fading an image into the page or softening the edge of a banner.
How do I put a gradient on text?
Copy the gradient and use it as the text's background, then clip it to the letters: background: linear-gradient(…); -webkit-background-clip: text; background-clip: text; color: transparent;. The letters then show the gradient instead of a solid colour.
This tool runs entirely in your browser. What you enter or upload stays on your device and is never sent to our servers.