RGB to OKLCh

Going through OKLCh lets you change lightness or chroma without the hue drifting, which is hard to do in RGB.

Hue
Alpha
100%
OKLCh
oklch(63.521% 0.17906 259.418)

Paste a RGB value — other formats work too.

Need every format at once? Open in the full picker

Worked examples

Common colours converted from RGB to OKLCh, computed with the same engine the picker uses.

ColourRGBOKLChCopy
Pure redrgb(255 0 0)oklch(62.796% 0.25768 29.234)
Pure greenrgb(0 255 0)oklch(86.644% 0.29483 142.495)
Pure bluergb(0 0 255)oklch(45.201% 0.31321 264.052)
Whitergb(255 255 255)oklch(100% 0 0)
Mid greyrgb(128 128 128)oklch(59.987% 0 0)
Blackrgb(0 0 0)oklch(0% 0 0)
Interface bluergb(66 135 245)oklch(63.521% 0.17906 259.418)
Success greenrgb(34 197 94)oklch(72.275% 0.19201 149.579)
Danger redrgb(239 68 68)oklch(63.683% 0.20785 25.331)
Warning amberrgb(245 158 11)oklch(76.859% 0.16466 70.08)
Editor blackrgb(30 30 30)oklch(23.503% 0 0)
Warm sandrgb(233 196 106)oklch(83.419% 0.11701 87.428)

How the conversion works

Going through OKLCh lets you change lightness or chroma without the hue drifting, which is hard to do in RGB.

Both formats are computed from a single canonical representation — CIE XYZ with a D65 white point, held in floating point — rather than by chaining one format into the next. That matters because chained conversions accumulate rounding error, and because it means a colour that cannot be represented in the target format is handled deliberately rather than by accident.

When the source describes a colour outside the target's gamut, chroma is reduced in OKLCh while lightness and hue are held, following the CSS Color 4 gamut mapping algorithm. Clipping each channel independently would be simpler but visibly shifts hue on saturated colours.

Related conversions