RGB to OKLCh
Going through OKLCh lets you change lightness or chroma without the hue drifting, which is hard to do in RGB.
Paste a RGB value. Other formats work too.
oklch(69.691% 0.14333 232.653)Need every format at once? Open in the full picker
Worked examples
Common colors converted from RGB to OKLCh, computed with the same engine the picker uses.
| Color | RGB | OKLCh | Copy |
|---|---|---|---|
| Pure red | rgb(255 0 0) | oklch(62.796% 0.25768 29.234) | |
| Pure green | rgb(0 255 0) | oklch(86.644% 0.29483 142.495) | |
| Pure blue | rgb(0 0 255) | oklch(45.201% 0.31321 264.052) | |
| White | rgb(255 255 255) | oklch(100% 0 0) | |
| Mid gray | rgb(128 128 128) | oklch(59.987% 0 0) | |
| Black | rgb(0 0 0) | oklch(0% 0 0) | |
| Interface blue | rgb(66 135 245) | oklch(63.521% 0.17906 259.418) | |
| Success green | rgb(34 197 94) | oklch(72.275% 0.19201 149.579) | |
| Danger red | rgb(239 68 68) | oklch(63.683% 0.20785 25.331) | |
| Warning amber | rgb(245 158 11) | oklch(76.859% 0.16466 70.08) | |
| Editor black | rgb(30 30 30) | oklch(23.503% 0 0) | |
| Warm sand | rgb(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 color that cannot be represented in the target format is handled deliberately rather than by accident.
When the source describes a color 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 colors.