🎨

CSS Gradient Generator

Build linear and radial CSS gradients visually, then copy the CSS.

Color Stops

#6366f10%
#ec4899100%

CSS

background: linear-gradient(135deg, #6366f1 0%, #ec4899 100%);
About this tool

Last updated:

Build a CSS gradient and copy the code

This CSS gradient generator lets you design a linear or radial gradient visually and copy the matching background rule. A preview strip at the top shows the result as you change it.

How to use it

  1. Choose Linear or Radial.
  2. For linear, drag the Angle slider (0–360°).
  3. Set each color stop: pick a color and move its position slider (0–100%).
  4. Click + Add stop for more colors. Remove a stop with the × button.
  5. Click Copy above the CSS line.

How it works

The tool sorts your stops by position and writes them into a gradient function. The output looks like this:

background: linear-gradient(135deg, #6366f1 0%, #ec4899 100%);

Radial mode produces radial-gradient(circle, ...) with the same stops.

What you see

  • A live preview of the gradient.
  • A Linear / Radial switch and, for linear, the current angle.
  • A row per color stop with a picker, hex value, position slider and remove button.
  • The final CSS line with a Copy button.

Assumptions and limits

  • At least 2 stops are required, so the last two cannot be removed.
  • A new stop starts as white at the midpoint between the first and last stops. Change its color and position as needed.
  • Radial gradients are always circular and centered. There is no shape, size or position option.
  • Colors are solid hex values from the picker, with no transparency.
  • There are no vendor prefixes, repeating gradients or conic gradients.

Frequently asked questions

What does the angle mean?

It is the direction of the gradient line in degrees. 0° runs bottom to top, 90° runs left to right and 180° runs top to bottom.

Can I paste my own hex code into a stop?

No. Colors are chosen with the browser color picker, and the hex value next to it is shown for reference only.

How do I use the copied code?

Paste the line into a CSS rule for any element, such as .hero { ... }, or into an inline style attribute.

More to explore

Related Developer Tools

Browse all tools from the same category.

Showing 1-2 of 49