How to use the css gradient generator
- Choose Linear, Radial or Conic.
- Click a color square to change it, and drag its slider to move the stop.
- Press Add color for more stops, or try a preset.
- Press Copy CSS, or Download PNG for a 1920 × 1080 image.
The three gradient types
| Type | What it does | CSS |
|---|---|---|
| Linear | Colors blend along a straight line | linear-gradient(135deg, #3b5bfd 0%, #ec4899 100%) |
| Radial | Colors spread outward from the center | radial-gradient(circle, #3b5bfd 0%, #ec4899 100%) |
| Conic | Colors sweep around the center like a color wheel | conic-gradient(from 0deg, #3b5bfd 0%, #ec4899 100%) |
Angles
In CSS, 0deg points up, 90deg points right, 180deg points down and 270deg points left. You can also write directions in words, such as to right or to bottom right.
Using the code
Paste the copied line into any CSS rule:
.hero { background: linear-gradient(135deg, #3b5bfd 0%, #ec4899 100%); }
Gradients are supported by every current browser with no prefixes, and they cost nothing to download because the browser draws them.
Design tips
- Pick neighbors. Colors close together on the color wheel, such as blue to purple, blend smoothly. Opposites such as red to green turn muddy in the middle.
- Fix a gray middle by adding a third stop of a brighter color between the two ends.
- Keep text readable. Check both ends of the gradient with the contrast checker, not just the middle.
- Hard stripes: give two stops the same position to create a sharp edge instead of a blend.
- Text gradients: add
background-clip: text; color: transparent;to apply the gradient to lettering.
Download the PNG if you need the gradient as a wallpaper, slide background or social media image.