CSS Gradient Generator

Pick two colours, an angle and a type, see the gradient live and copy the CSS.

Linear and radial

Linear gradients blend along a straight line at the angle you choose; radial gradients spread outward from the centre.

Use the output

The tool shows a ready-to-paste background rule, for example background: linear-gradient(135deg, #3b82f6, #8b5cf6);.

How to use it

  1. Choose Color 1 and Color 2.
  2. Set the Angle and Type.
  3. Copy the CSS shown beneath the preview.

Default output

With the default colours and angle:

background: linear-gradient(135deg, #3b82f6, #8b5cf6);

Common use cases

Reading the angle

The angle is the direction the colour travels, measured clockwise from straight up. 0deg runs bottom to top, 90deg left to right, 180deg top to bottom (the browser default) and 270deg right to left. Diagonals fall between them, and 135deg blends from the top-left corner towards the bottom-right. The field accepts 0 to 360 as steppable values, but typing a larger number will still be written into the CSS, and browsers wrap it around.

For radial gradients the angle field has no effect. The tool outputs a circle starting at the centre, for instance background: radial-gradient(circle, #3b82f6, #8b5cf6);, with the first colour in the middle and the second at the edge.

Extending the output by hand

The tool writes exactly two colour stops, both as HEX with no transparency. Because the output is ordinary CSS, small manual edits go a long way:

Quality and compatibility notes

The generated rule uses the background shorthand, which also resets background image, size and repeat. If an element already has a background image you want to keep, change the property to background-image, and add a plain background-color line beforehand as a fallback while the page loads.

Smooth gradients between two similar colours can show visible banding on some screens, especially over large areas. Using colours that differ more in lightness, or adding a subtle noise texture, reduces it. Contrast-wise, check text placed over the lightest part of the gradient, not the average colour, because that is where readability fails first.

Colours blend in sRGB by default, so mixing two saturated hues such as blue and yellow can produce a muddy grey-green midpoint. If that happens, insert a mid colour you pick yourself between them.

Frequently asked questions

What does the angle do?

It sets the direction of a linear gradient; 135deg runs from top-left to bottom-right.

Can I use more than two colours?

This tool builds two-colour gradients.

Is the CSS supported everywhere?

Linear and radial gradients are supported by all current browsers.

Is my data uploaded?

No. This tool runs entirely in your browser, so what you type or paste is not sent to our servers.

Why does the angle not change my radial gradient?

A circular radial gradient radiates from the centre, so direction does not apply. Only the colours matter in that mode.

How do I make a gradient with a hard stop?

Edit the copied CSS and give two adjacent colours the same position, for example #3b82f6 50%, #8b5cf6 50%.

Related tools

Explore all developer tools →