Skip to content
RGBHex

OKLCH Gradient Generator

Build perceptually smooth CSS gradients. Interpolating in OKLCH/OKLAB keeps every midpoint luminous; sRGB passes through a muddy gray dead zone. Stops, space, and angle live in the URL, so the gradient is a shareable link.

sRGB — desaturated, muddy midpoint
OKLCH — luminous all the way through
Color stops
Interpolation space
Export
CSS — dense stops (works everywhere)
background: linear-gradient(90deg, #3b82f6 0.0%, #677af9 9.1%, #8773f6 18.2%, #a16ced 27.3%, #b866df 36.4%, #cc61cd 45.5%, #dc5eb7 54.5%, #ea5c9f 63.6%, #f35d84 72.7%, #f96168 81.8%, #fb6847 90.9%, #f97316 100.0%);
CSS — native interpolation
background: linear-gradient(90deg in oklch, #3b82f6 0.0%, #f97316 100.0%);
Tailwind
bg-[linear-gradient(90deg_in_oklch,_#3b82f6_0.0%,_#f97316_100.0%)]

Color-vision preview

How this gradient appears to viewers with each color-vision deficiency. If steps that should read as distinct merge, add a non-color cue or widen their lightness.

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.

Reviewed by Jimmy Raymond, Engineer
B.S. Environmental Engineering · B.S. Computer Science · Last reviewed June 2, 2026

Spotted an error? Let us know — reader corrections are the best review this site gets.