RGB to OKLCH converter
Convert RGB to OKLCH lightness, chroma and hue.
Example: rgb(255, 107, 53)
Convert RGB to OKLCH lightness, chroma and hue.
Example: rgb(255, 107, 53)
Image editors, color pickers and canvas code give you RGB, while modern CSS and design-token workflows increasingly use OKLCH. Going from RGB is the safe direction: every sRGB color has an exact OKLCH equivalent, so nothing needs to be clipped.
About the formats. RGB gives the amount of red, green and blue light as three numbers from 0 to 255, as in rgb(255, 107, 53). Both the comma form and the space form rgb(255 107 53 / 50%) are read, and percentages work too. OKLCH is a perceptual color model built on Björn Ottosson's OKLab space: L is lightness from 0% to 100%, C is chroma (how vivid the color is, from 0 for grey up to about 0.32 inside sRGB) and H is the hue angle in degrees. Lightness tracks what the eye sees, so equal L values look equally light.
How exact is it? RGB channels are read as they are and rounded to the nearest whole number when they carry decimals, so a normal rgb() value is never altered. Every sRGB color has an exact OKLCH value. It is shown to four decimals for chroma and two for lightness and hue, so converting it back can differ by one step in a single channel for roughly 1 color in 1,000.
For example, rgb(59, 130, 246) in RGB is oklch(62.31% 0.188 259.81) in OKLCH. The calculation runs through linear light and the OKLab space, using Björn Ottosson's published matrices. The result is shown with lightness as a percentage, chroma to four decimals and hue in degrees, which is the form you can paste straight into oklch().
Type or paste an RGB value such as rgb(59, 130, 246) and the OKLCH value, oklch(62.31% 0.188 259.81), appears straight away. Use Copy to put it on your clipboard, or choose a color with the picker.
Lightness runs from 0% (black) to 100% (white). Chroma is 0 for greys and reaches about 0.32 for the most vivid colors inside sRGB. Hue is an angle from 0° to 360°, with red near 29°, green near 142° and blue near 264°.
That is the point of the model. OKLCH is built on a perceptual space, so its lightness follows what people actually see, unlike the L in HSL.
RGB channels are read as they are and rounded to the nearest whole number when they carry decimals, so a normal rgb() value is never altered. Every sRGB color has an exact OKLCH value. It is shown to four decimals for chroma and two for lightness and hue, so converting it back can differ by one step in a single channel for roughly 1 color in 1,000.
Yes. Add transparency to the RGB value and it is carried over to the OKLCH result, which supports it too.
No. The conversion runs in your browser and nothing is uploaded.