CSS Gradient Generator
Design a background gradient by eye and get clean CSS for it. Pick two or more colours, drag the angle or centre, make stops transparent, and the preview and code update together. The code works in every current browser without prefixes.
About the CSS Gradient Generator
A gradient is a smooth blend between colours that the browser paints itself, so it needs no image file and stays sharp at any screen size. Writing it by hand is fiddly: angles, stop positions and transparency are hard to picture. This generator lets you adjust everything visually and writes the code for you.
The three kinds
- Linear blends along a straight line. 0° runs from bottom to top, 90° from left to right and 180° from top to bottom.
- Radial spreads out from a centre point, either as a circle or as an ellipse that follows the shape of the box.
- Conic sweeps around a centre like the hands of a clock. It suits pie-chart backgrounds and colour wheels.
Worked example
Press the Tricolour preset. You get three stops: saffron at 0%, white at 50% and green at 100%, with a direction of 180°, so the colours run from top to bottom. Change the white stop’s position to 40% and the green band becomes deeper. Set the opacity of the first stop to 0% and the top fades to transparent, which is useful for laying a gradient over a photo.
Tips for good-looking gradients
Two colours that sit close together on the colour wheel blend cleanly. Opposite colours, such as red and green, pass through a dull grey in the middle; adding a third stop between them keeps the blend bright. Space evenly spreads the stops out again after you have moved them around, and Reverse flips the order.
What the code contains
The rule first sets background-color to the first colour, then background-image to the gradient. Browsers that understand gradients paint the gradient on top, and anything older still shows a sensible flat colour. Use Copy value only when a page builder asks just for the gradient itself.
Limits
Gradients with many hard stops can show slight banding on some screens. The preview uses your own browser, so check the result in the other browsers your visitors use if exact rendering matters.
How to use CSS Gradient Generator
- Start from a preset or change the colours, positions and opacity of each stop.
- Choose linear, radial or conic, then set the angle, shape or centre.
- Check the preview, then copy the CSS or download it as a .css file.
Privacy: how it works
Everything happens in your browser. Nothing you choose or type is sent to any server.
Frequently asked questions
Do I need -webkit- prefixes?
No. linear-gradient, radial-gradient and conic-gradient work unprefixed in current Chrome, Edge, Firefox and Safari. The code also sets a plain background colour first, which very old browsers show instead.
Which colour formats can I type?
HEX (#1d4ed8 or #1d4ed880), rgb(), hsl() and hsv(). The code is written in HEX, or rgba() when a stop is partly transparent.
Why does the repeat option change nothing?
Repeating only shows when the last stop ends before 100%. Set the stops to, say, 0% and 20% and the pattern repeats five times.