CSS gradient generator
Design linear, radial or conic gradients with up to four colors, control the angle and stops, see the result live and copy the CSS. Free, and it runs in your browser.
How to use it
- Pick the Gradient type and the Number of colors.
- Choose each color, and set the Angle or the center position if you need it.
- Optionally set the stop percentages, then click Copy on the CSS code.
Complete guide to CSS gradients
What a CSS gradient is
A gradient is a smooth transition between two or more colors that the browser draws for you. Because it is generated by CSS, it needs no image file, scales to any size without blurring and loads instantly. Gradients are used for hero backgrounds, buttons, cards, progress rings and subtle depth behind text. The syntax is easy to forget, especially the angle conventions and the color stop positions, so this tool lets you choose the colors, see the result live and copy the exact background declaration.
The three types
| Type | Function | How colors flow | Typical use |
|---|---|---|---|
| Linear | linear-gradient() | Along a straight line at an angle | Backgrounds, buttons, banners |
| Radial | radial-gradient() | Outward from a center point, as a circle or ellipse | Glows, spotlights, soft vignettes |
| Conic | conic-gradient() | Around a center point, like a clock hand sweeping | Color wheels, pie-style charts |
Angle, shape, position and stops
- Angle (degrees): for linear gradients, 0 deg points up, 90 deg points right, 180 deg down and 270 deg left. For conic gradients it is the starting angle of the sweep. Radial gradients ignore it.
- Radial shape chooses a circle or an ellipse that stretches to the box.
- Center position (radial and conic) places the center at the middle, an edge or a corner.
- Stop (%) is where a color is at full strength, from 0 to 100. Leave the stop fields empty and the colors are spread evenly: with 3 colors they land at 0%, 50% and 100%, with 4 at 0%, 33.33%, 66.67% and 100%.
Pick two, three or four colors with Number of colors. The color fields use the browser color pickers, so the output always contains valid HEX values. Everything runs in your browser.
Worked example
- With the defaults the tool prints
background: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 50%, #ec4899 100%);: blue to violet to pink, left to right. - Choose 2 colors, set Color 1 to red, Color 2 to blue and Angle (degrees) to 45. The result is
background: linear-gradient(45deg, #ff0000 0%, #0000ff 100%);, running from the bottom left corner toward the top right. - Choose Radial, 2 colors, Ellipse and Top left, with Stop 1 (%) 10 and Stop 2 (%) 80. The result is
background: radial-gradient(ellipse at top left, #3b82f6 10%, #8b5cf6 80%);. Before 10% the first color stays solid and after 80% the second one does. - Choose Conic, 4 colors and angle 30. The result is
background: conic-gradient(from 30deg at center, #3b82f6 0%, #8b5cf6 33.33%, #ec4899 66.67%, #f59e0b 100%);.
Tips and common mistakes
- Gradients between very different hues, such as blue to orange, can pass through a muddy gray in the middle. Add a third color in between to control the path.
- Two colors at the same stop make a hard edge instead of a blend, which is how stripes and pie slices are drawn. Try equal values in two adjacent stop fields.
- Keep text readable over the gradient. Check the lightest and darkest areas with the contrast checker, not just the middle.
- Stops must be between 0 and 100 and the angle between 0 and 360, otherwise the tool shows an error.
- Conic gradients need a reasonably recent browser. Set a plain
background-colorbefore the gradient as a fallback.
Related tools
Get matching colors from the color palette generator, convert them between formats with the color converter, or round the box that holds the gradient with the border radius generator.
Questions
What is the difference between the three types?
Linear blends colors along a straight line at an angle. Radial blends outward from a center point. Conic sweeps the colors around a center, like a pie chart or color wheel.
What are color stops?
A stop is the position, from 0% to 100%, where a color is at full strength. Leave them empty and the tool spreads the colors evenly.
Does the angle apply to every type?
It sets the direction of linear gradients and the starting angle of conic ones. Radial gradients ignore it and use the center position instead.
Will the code work in every browser?
Yes, in all current browsers. Conic gradients need a reasonably recent browser, so keep a plain background color as a fallback if you support old ones.