A CSS gradient generator builds the code for a smooth blend between colours. Choose linear or radial, set two to eight colour stops with their positions, adjust the angle, and watch the preview. Then copy the background declaration, which includes a solid fallback colour, into your style sheet.
How to use the Gradient Generator
- Choose the typeSelect linear for a straight blend or radial for one that spreads from the centre.
- Set the colour stopsPick each colour and drag its slider to place it between 0% and 100%. Add stops for more colours or press Random colours.
- Adjust the angleFor linear gradients, drag the angle slider: 90° runs left to right and 180° runs top to bottom.
- Copy the CSSPress Copy and paste the two background lines into your CSS rule.
How CSS gradients work
In CSS a gradient is an image created by the browser, so it is used with background or background-image, not background-color. This CSS gradient generator writes the two most useful kinds:
- linear-gradient(angle, stops) blends along a straight line. The angle says which way the line points: 0deg goes bottom to top, 90deg left to right, 180deg top to bottom and 270deg right to left.
- radial-gradient(shape at position, stops) blends outwards from a point. A circle spreads evenly; an ellipse stretches to match the shape of the element.
Each colour stop is a colour and a position. Between two stops the browser blends evenly. Move two stops close together for a sharp change, or give two stops the same position for a hard edge, which is how stripes are made.
Gradients are drawn by the browser at any size, so they stay sharp on every screen and add almost nothing to page weight compared with an image file.
The preview and the code update as you move any control, and everything runs in your browser.
Tips for good-looking gradients
- Stay close on the colour wheel. Neighbouring hues, such as blue to purple, blend cleanly. Opposites, such as red to green, pass through a muddy grey-brown in the middle; add a third stop with a brighter in-between colour to fix it.
- Keep text readable. Contrast changes across a gradient, so check your text against both the lightest and darkest parts.
- Use subtle gradients for large areas. A small change in lightness of one colour often looks more polished than a rainbow.
- Match the angle to the layout. Diagonal gradients (around 135°) feel dynamic; vertical ones feel calm.
- Keep the fallback. The first line of the output is a solid colour for the rare browser or email client that ignores gradients.
Need colours that match? Start with the colour palette generator. To add depth to the element you are styling, try the box shadow generator.
Frequently asked questions
How do I make a gradient in CSS?
Use the background property with linear-gradient() or radial-gradient(), for example background: linear-gradient(90deg, #2563eb 0%, #ec4899 100%). The CSS gradient generator writes this for you.
What does the angle mean in a linear gradient?
It is the direction the gradient travels. 0deg points up, 90deg points right, 180deg points down and 270deg points left.
How many colours can a gradient have?
CSS has no fixed limit. This tool supports two to eight colour stops, which covers almost every practical design.
Do CSS gradients work in all browsers?
Yes. Linear and radial gradients have been supported without prefixes in every major browser for many years.
Can I use a gradient on text?
Yes. Apply the gradient as the background of the text element, then add background-clip: text (with the -webkit- prefix as well) and color: transparent.
Last updated 24 November 2026 by the TheTechFolk team.