CSS gradient generator

Build a linear or radial CSS gradient with up to five colour stops. Set positions and angle, preview the background and copy the CSS.

Colour stops

Gradient preview

background: linear-gradient(125deg, #C6B5FF 0%, #5231A8 100%);

How CSS gradient angles and stops work

In a linear gradient, 0° points up, 90° points right and 180° points down. A radial gradient spreads from the centre. Change the gradient type to preview the difference with the same colours.

Set each stop as a percentage along the gradient. Stops with the same position can make a hard edge. The copied background declaration can go directly inside a CSS rule.

To avoid muddy mid-tones between two bright hues, add an intermediate stop with a subtle tint or adjust the stop percentages so the transition completes closer to one edge.

Common questions

How many colour stops can I add to a gradient?

You can configure between two and five colour stops, each with its own HEX colour and percentage position along the gradient line.

Where should I paste the generated CSS declaration?

Paste the copied background declaration directly inside any CSS class, ID or style rule, or pair it with a solid fallback background colour above it.