Skip to content
M2TOOLKIT

CSS Gradient Generator

Design a CSS gradient visually and copy the code.

Use it as often as you like — it's free, with no sign-up and no limits.

  • Design
  • Free
  • No sign-up
  • Runs in your browser
  • Updated
Type
135°
0%
100%

Everything you type is processed in your browser. Nothing you enter is sent to our servers or stored by us.

How to use the CSS Gradient Generator

  1. Choose linear or radial.
  2. Set the angle and colors.
  3. Drag each color's position.
  4. Copy the CSS.

What does this tool do?

The generated CSS includes a solid background color first as a fallback, then the gradient. All modern browsers support CSS gradients without prefixes.

Why use it?

  • Hero sections and buttons.
  • No image files needed.
  • Up to six color stops.

Use cases

  • Hero and section backgrounds.
  • Buttons and badges with depth.
  • Overlays that keep text readable on photos.

Example

background: linear-gradient(135deg, #2c48d6 0%, #b02a6b 100%);

Common mistakes

  • Too many colour stops, which look busy.
  • Light text on the lightest part of the gradient.
  • Forgetting a solid fallback colour (the generator adds one).

Privacy

Everything you type is processed in your browser. Nothing you enter is sent to our servers or stored by us. There's no account to create and nothing to install.

Frequently asked questions

Why does my gradient look gray or muddy in the middle?

Blending very different colors in the default sRGB color space passes through dull grays. Modern browsers let you blend in another space, such as linear-gradient(in oklch, …), which keeps the middle more vivid.

Can I animate a CSS gradient?

Gradients can't be transitioned directly. Common workarounds are animating background-position on an oversized gradient, or animating custom properties registered with @property.

Linear or radial?

Linear for backgrounds and bars; radial for glows and spotlights.

How do I add an overlay on a photo?

Layer a gradient over the image in background, such as a dark-to-transparent gradient for readable text.

Content last updated . See how M2Toolkit works.

Other tools people use alongside the css gradient generator.