CSS Gradient Generator

Create beautiful CSS gradients visually. Copy the code and paste it into your project.

Type
Angle: 135deg
Color Stops
Quick Presets
CSS Code
background: linear-gradient(135deg, #7C3AED 0%, #06B6D4 100%);
Who this tool is for:

Best for: Building a linear, radial or conic gradient and copying the CSS straight into a stylesheet, and adjusting angle and colour stops visually

Limitations: Outputs CSS gradient code only, so it does not export a PNG or SVG for use in a design tool

Best suited for: Front-end developers who want gradient CSS without hand-writing colour stop syntax

How the Generator Builds Its CSS

Pick Linear, Radial or Conic, set the angle (Linear only, 0 to 360deg) and edit the color stops. The CSS box shows exactly what the preview uses, such as background: linear-gradient(135deg, #7C3AED 0%, #06B6D4 100%);. Radial output always starts radial-gradient(circle, and Conic output conic-gradient(from 0deg,, with no control for shape, center or start angle. The eight Quick Presets are all linear: six at 135deg, Neon at 90deg and Minimal at 180deg.

The stop list keeps the order you added stops in, but the CSS writes them sorted by position, lowest first, and stops at the same position stay in list order. The preview and the Copy button use that same CSS. The generator never adds a color interpolation method such as in oklab, so every gradient it outputs uses the browser default described below.

Why the Middle of a Gradient Goes Muddy

CSS Color 4 says legacy sRGB colors, which include the hex codes this tool writes, interpolate "in gamma-encoded sRGB space" by default. Between two far-apart hues every channel lands near its middle value, so the color drains out. One pair, computed with this site's own code and rendered in Chromium 148 (method):

Two gradients from #2563EB to #F59E0B. In sRGB the midpoint is #8D817B, a grey brown with Oklab chroma 0.017; in Oklab it is #938EA4 with chroma 0.033.
Computed with this site's own code, then the CSS rendered in Chromium 148. Not a test with people.
CSSMidpoint computedMidpoint renderedOklab chroma
background: linear-gradient(to right, #2563EB, #F59E0B);#8D817B#8D807B0.017
background: linear-gradient(in oklab to right, #2563EB, #F59E0B);#938EA4#938DA30.033

The rendered pixels differ from the computed midpoints by at most one unit per channel. Both midpoints are low in chroma because blue and amber sit nearly opposite each other, but Oklab keeps about twice as much. To use it here, copy the CSS and type in oklab before the angle: linear-gradient(in oklab 135deg, #7C3AED 0%, #06B6D4 100%). More in the CSS gradient guide and on fixing muddy gradients.

Frequently Asked Questions

No. Its code writes only the gradient type, the angle or fixed shape, and the stops, so every gradient uses the browser default, which for hex colors is gamma-encoded sRGB. To switch a linear gradient to Oklab, add in oklab before the angle in the copied CSS, for example linear-gradient(in oklab 135deg, #7C3AED 0%, #06B6D4 100%).
Because the channels are averaged in sRGB. For #2563EB to #F59E0B the computed midpoint is #8D817B with Oklab chroma 0.017, and Chromium 148 rendered #8D807B. Written with in oklab, the midpoint is #938EA4 with chroma 0.033. A third stop with a brighter middle color also keeps the center from going muddy.
Radial writes radial-gradient(circle, followed by your stops, so it is always a circle. Conic writes conic-gradient(from 0deg, followed by the stops. The angle slider is hidden for both and only applies to Linear. Edit the copied CSS by hand if you need another shape or start angle.
Press Add Stop. It adds a random color at 50% to the end of the list. The CSS, the preview and the Copy button always use the stops sorted by position, so the new stop sits between 0% and 100%; stops at the same position keep their list order. At least two stops are required; the remove button is disabled at two.
No. The tool outputs CSS text only, with a Copy button. Its color fields take six-digit hex, so there is no alpha channel. For a fade, edit the copied CSS by hand.
Related Tools

Get fresh reads straight to your inbox

Get notified when we publish new articles. Unsubscribe anytime.