How to use the gradient generator
Add two or more color stops in any CSS format — hex, rgb(), hsl(), or oklch(). Choose the interpolation space (OKLCH, OKLAB, or sRGB for comparison), set the angle, and tune the smoothness. The two strips show the same stops rendered through sRGB and OKLCH so you can see the dead-zone difference directly. Copy the CSS, native, or Tailwind export — your gradient is encoded in the URL for sharing.
Why interpolation space matters
A gradient is a path between colors. In sRGB that path is a straight line through a non-perceptual cube, so it dips through desaturated grays. OKLCH and OKLAB are designed so that equal numeric steps look like equal perceptual steps — the path keeps its lightness and chroma, and the result reads as smooth. The interpolation here is computed with culori, with shortest-path hue and sRGB-fallback output.
Frequently asked questions
Why do my CSS gradients look muddy or gray in the middle?
Because they're being interpolated in sRGB — blending the color channels directly, which is what `linear-gradient(… in srgb …)` and older browsers do. Blending two saturated, opposite hues (e.g. blue and yellow) passes through low-saturation values, so the midpoint desaturates toward gray. Modern browsers now default gradient interpolation to OKLAB, which avoids the dead zone; OKLCH goes a step further by taking the shortest path around the hue wheel. Pick the space explicitly — or export dense stops — to get the perceptual result in every browser.
What's the difference between OKLCH and OKLAB interpolation here?
Both are perceptual and avoid the gray dead zone. OKLCH interpolates hue on a circle (taking the shortest path around the wheel), which keeps transitions vivid and is usually what you want for two distinct hues. OKLAB interpolates on rectangular axes, giving a slightly straighter, sometimes desaturated path through the middle. Try both and pick what looks best.
Which export should I use — dense stops or native interpolation?
The native form, `linear-gradient(90deg in oklch, …)`, is terse and correct, but only in browsers that support CSS Color 4 interpolation. The dense-stops form pre-samples the perceptual curve into many plain hex stops, so it renders the same smooth result in any browser. Use native where you control the browser baseline; use dense stops for maximum compatibility.
Does this handle the 0°/360° hue wraparound?
Yes. OKLCH hue interpolation takes the shortest path around the color wheel, so a gradient from hue 20° to 340° crosses through 0° rather than sweeping the long way through 180°. That avoids accidentally cycling through unwanted colors.
Are wide-gamut colors supported?
Interpolation happens in OKLCH/OKLAB, which can express colors beyond sRGB. The hex stops in the dense export are mapped to the closest sRGB-displayable color (chroma-clamped, preserving hue and lightness). The native export preserves your original color values for wide-gamut-capable displays.
Related tools
References
This tool’s color math is grounded in the following standards and primary sources.
- CSS Color 4 — interpolation & color spaces — W3C — gradient interpolation rules
- A perceptual color space for image processing (OKLab / OKLCH) — Björn Ottosson, 2020
- culori — color library — Dan Burzo (MIT)
Spotted an error? Let us know — reader corrections are the best review this site gets.