Free online tools

CSS Gradient Generator

Build a linear background gradient with two or three colors. Set the direction and stop positions, preview the result, and copy the CSS declaration.

Enter your values

0° points up. 90° runs left to right.

Used when the middle stop is included.

This tool processes your input in your browser.

Result

Set the direction

Use 90 degrees for a left-to-right gradient and 180 degrees for a top-to-bottom gradient. The browser measures each percentage along the line of the gradient. The length of that line depends on the shape of the box.

Place your color stops

The first, middle and last positions must be in order. Two colors at the same position create a hard edge. Repeating mode repeats the interval between the first and last stops, so space them apart to create visible bands.

Frequently asked questions

How do I apply the result?

Copy the background-image declaration into the CSS rule for the element you want to fill. Give the element a height or enough content to show the background.

Why does the gradient look different on a wide banner?

The angle and stop percentages remain the same, but the gradient line adapts to the proportions of the element. Preview it on an element with your final dimensions.