Skip to content
hateitall

CSS Gradient Generator

Design a gradient visually and take away CSS that works everywhere, or an image at any size.

Processed locallyIn: ColourOut: CSS, PNG, JPEG, SVG

Loading tool…

How to use css gradient generator

  1. Start from a preset or press Random.

  2. Pick linear, radial or conic and set the angle or centre.

  3. Edit up to eight colour stops and their positions, and choose the colour space to blend in.

  4. Copy the CSS, or choose a size and download a PNG, JPEG or SVG.

What this tool does

  • Writes modern CSS with an interpolation space (in oklch, in oklab) plus an sRGB fallback line with the blend baked into extra stops.
  • Draws the image with the same geometry CSS uses: gradient line length for angles, farthest-corner sizing for radial shapes and a 12 o'clock start for conic.
  • Exports PNG or JPEG at any size up to 8192 pixels and SVG for linear and radial gradients.
  • Blends translucent stops with premultiplied alpha, as browsers do, so fades to transparent do not turn grey.

How the result is verified

Each exported image is decoded again and its width and height checked before the download starts. The preview box is painted with the exact CSS shown.

Frequently asked questions

Why does my blue to yellow gradient look grey in the middle?

Blending in sRGB passes through a dull mix of the two. Choose OKLCH and the gradient travels around the hue wheel instead, staying vivid. OKLab is a middle ground that keeps lightness even without changing hue path.

Do older browsers understand "in oklch"?

Browsers from before 2023 ignore that line. That is why the CSS has a plain sRGB line first: older browsers use it, newer ones override it with the second line.

Is my data uploaded to a server?

No. Everything you drop, paste or type is processed by code running in this browser tab. You can check it yourself: open your browser's developer tools, watch the Network panel, and use the tool. No request carries your data.

Drag colour points to make soft blended gradients as CSS, PNG or SVG

Colour→ CSSLight on device

50 to 950 scales, harmonies and tints from one colour

Colour · HEX · CSS colour→ CSSLight on device

HEX, RGB, HSL, OKLCH, OKLab, Lab and P3 with gamut warnings

Colour · HEX · CSS colour→ HEXLight on device

Grids, dots, stripes and checks made only of CSS gradients

Colour→ CSSLight on device