CSS Gradient Generator
Build linear and radial CSS gradients with two colour stops, an angle slider and a live preview — then copy the code.
Pick your colours, choose linear or radial, set the angle, and copy ready-to-paste CSS from a live preview. Free. No sign-up. Runs in your browser, nothing is uploaded.
background: linear-gradient(90deg, #6366f1, #ec4899);Choose two colours, pick Linear or Radial, set the angle and copy a ready background: declaration. Need more than two colours? Add up to three extra stops, each with its own position — five colours in total. The preview updates as you drag, and the page address always holds the current gradient, so Copy link shares exactly what you see.
Angles at a glance
| Angle | Direction of travel | Keyword equivalent |
|---|---|---|
| 0deg | bottom → top | to top |
| 45deg | towards the upper right, at 45° | (to top right aims at the corner instead) |
| 90deg | left → right | to right |
| 135deg | towards the lower right | — |
| 180deg | top → bottom (the default) | to bottom |
| 270deg | right → left | to left |
The angle describes where the gradient is heading, measured clockwise from straight up. People often expect 0deg to mean "left to right" because that's how many design apps work; in CSS it points upward.
What the generated CSS looks like
Two colours give the short form:
background: linear-gradient(90deg, #6366f1, #ec4899);
With extra stops, every colour gets a position, sorted from 0% to 100%:
background: linear-gradient(90deg, #6366f1 0%, #ffffff 50%, #ec4899 100%);
The radial option produces radial-gradient(circle, …), a circle centred on the element. To move its centre, edit the copied line to radial-gradient(circle at top left, …) or circle at 30% 20%.
Fixing a muddy midpoint
The most common gradient complaint is the dull band in the middle. It happens because the browser mixes colours channel by channel in sRGB, and opposite hues cancel each other out:
| From | To | Midpoint the browser shows |
|---|---|---|
| #3b82f6 (blue) | #f59e0b (amber) | #989081 (greyish) |
| #6366f1 (indigo) | #ec4899 (pink) | stays colourful — the hues are neighbours |
Three ways out:
- Add a middle stop with a saturated colour that belongs between the two — for blue to amber, a teal or a pink at 50% keeps it lively.
- Choose neighbouring hues. The Color Palette Generator shows analogous colours that blend cleanly.
- Interpolate in a perceptual colour space. Modern browsers accept
linear-gradient(in oklch 90deg, #3b82f6, #f59e0b), which travels around the colour wheel instead of through grey. Add it by hand to the copied CSS; older browsers will ignore the whole declaration, so keep the plain version as a fallback line above it.
Hard edges and stripes
Two stops at the same position create a sharp line instead of a blend. For example, add two extra stops both at 50% — one in each half's colour — and you get a two-tone split, handy for buttons or section dividers. The swap button flips start and end colours without retyping.
Using gradients behind text
A gradient changes colour across its width, so text contrast changes with it. Check the lightest and the darkest part of the gradient against your text colour separately with the Color Contrast Checker. For large, dark backgrounds, very subtle gradients can show visible "banding" steps on some screens; a slightly bigger colour difference or a faint noise texture hides it.
To convert any stop to RGB or HSL, use the Color Converter. For a frosted-glass card on top of your gradient, the Glassmorphism Generator builds the matching CSS.
Frequently asked questions
Related tools
All Color tools →- Color ConverterConvert any color between HEX, RGB and HSL instantly — pick, preview and copy in one place.
- Color Contrast CheckerCheck text-vs-background contrast against WCAG AA & AAA — with a live preview.
- Image Color Palette ExtractorPull the dominant color palette out of any image — right in your browser.
