All tools

CSS gradient generator

Design linear, radial and conic gradients visually.

Configuration

Type
Colors
Presets

Result

CSS
background: #ff7e5f;
background: linear-gradient(90deg, #ff7e5f 0%, #feb47b 100%);

About the CSS gradient generator

CSS gradients create smooth color transitions without image files, so they load instantly, scale to any size and are easy to change. Writing them by hand means guessing angles and stop positions until it looks right.

This generator shows the gradient as you build it. Choose a linear, radial or conic gradient, adjust the colors and their positions, and copy CSS that works in every modern browser.

How to use the CSS gradient generator

  1. Choose Linear, Radial or Conic as the gradient type.
  2. Set the angle, or the shape and position for radial and conic gradients.
  3. Edit the colors with the color picker or a hex value, drag each color's position slider, and use Add color for more stops.
  4. Check the live preview, then click Copy CSS and paste it into your stylesheet.

Examples

Diagonal two-color background

Input

Linear · 135deg · #6EE7B7 0% → #3B82F6 100%

Output

background: #6ee7b7;
background: linear-gradient(135deg, #6ee7b7 0%, #3b82f6 100%);

The first line is a solid fallback color for anything that can't draw gradients.

Soft spotlight

Input

Radial · circle at top · #FDE68A 0% → #FFFFFF 60%

Output

background: #fde68a;
background: radial-gradient(circle at top, #fde68a 0%, #ffffff 60%);

Common errors and how to fix them

The gradient doesn't show at all

Gradients are images, so use background or background-image, not background-color. The element also needs a height; an empty div is 0px tall.

Visible bands in the gradient

Long gradients between similar colors can show stripes on 8-bit screens. Add a middle color stop, or a tiny noise texture on top.

The gradient repeats in stripes down the page

On body, the gradient tiles every viewport height. Add background-attachment: fixed or set min-height: 100vh on html.

Good to know

  • Linear gradients run in a straight line at the angle you set: 0° goes bottom to top, 90° left to right and 180° top to bottom.
  • Radial gradients spread out from a point as a circle or ellipse, and conic gradients sweep around a point like a color wheel.
  • You can use 2 to 8 colors. Stops are written in order of position, and each position is a percentage of the gradient's length.
  • The code includes a solid background color first as a fallback. Use it as background or background-image on any element.
  • Reverse flips the color order, and Random creates a new gradient you can refine.

Frequently asked questions

How do I make text with a gradient?

Apply the gradient as background-image on the text element, then add background-clip: text and color: transparent. Check the contrast with the background, because gradient text can be hard to read.

Do CSS gradients work in all browsers?

Linear and radial gradients work in every modern browser, and conic gradients work in all current versions of Chrome, Edge, Firefox and Safari. Vendor prefixes are no longer needed.

How do I create a hard line instead of a smooth blend?

Give two neighbouring colors the same position, for example 50% and 50%. The color then changes instantly at that point, which is useful for stripes and split backgrounds.