Skip to content
ColorsGuide

RGB to OKLCH converter

Enter a RGB value such as rgb(58 134 255) to convert it to OKLCH. Every other format is shown too, and the result updates as you type.

Example paletteUsed until you create or choose your own

Detected RGB.

Examples: #1e90ff, rgb(30 144 255 / 50%), hsl(210 100% 56%), oklch(0.65 0.18 255), cmyk(88% 44% 0% 0%), tomato

Name
Blue(descriptive)
Alpha
100%
Relative luminance
0.2517
Perceived lightness (OKLCH L)
63.7%
Contrast on white
3.48:1
Contrast on black
6.03:1

See shades, harmonies and palettes for #3A86FF

Converted values

  • HEX#3a86ff
  • RGBrgb(58 134 255)
  • HSLhsl(216.9 100% 61.4%)
  • HSV / HSBhsv(216.9 77.3% 100%)
  • HWBhwb(216.9 22.7% 0%)
  • OKLCHoklch(63.71% 0.1953 259.51)
  • OKLABoklab(63.71% -0.0356 -0.192)
  • CIELABlab(56.18% 9.11 -68.23)
  • CMYKcmyk(77% 47% 0% 0%)

CMYK is a naive, device-independent approximation. Real print colours depend on the ink, paper and ICC profile your printer uses, so ask your printer for a proofed conversion. HSV/HSB is not a CSS format and is shown for design apps. CIELAB uses the D50 white point, as in CSS lab().

How to convert RGB to OKLCH

  1. Divide each channel by 255 and linearise it with the sRGB transfer function.
  2. Transform linear RGB to OKLab with Björn Ottosson's matrices.
  3. Convert OKLab to polar form: chroma √(a² + b²) and hue atan2(b, a).
  4. Express lightness as a percentage for CSS: oklch(L% C H).

About RGB

RGB gives the same three sRGB channels as decimal numbers from 0 to 255 (or 0–100%). Modern CSS writes rgb(255 87 51 / 50%) with spaces and a slash before the alpha; the older comma form rgba(255, 87, 51, 0.5) still works everywhere.

About OKLCH

OKLCH is a perceptual colour space: L is perceived lightness (0–100%), C is chroma (colourfulness) and H is hue. Equal steps look roughly equal to the eye, which makes it the best choice for building colour scales and accessible palettes. Supported natively in CSS.

Examples

SwatchRGBOKLCH
rgb(255 255 255)oklch(100% 0 0)
rgb(0 0 0)oklch(0% 0 0)
rgb(255 0 0)oklch(62.8% 0.2577 29.23)
rgb(0 168 107)oklch(64.48% 0.1488 158.78)
rgb(30 144 255)oklch(65.2% 0.1901 253.21)
rgb(255 215 0)oklch(88.68% 0.1822 95.33)
rgb(128 0 128)oklch(42.09% 0.1935 328.36)
rgb(255 127 80)oklch(73.51% 0.168 40.25)
rgb(112 128 144)oklch(59.25% 0.0309 248.35)
rgb(245 245 220)oklch(96.36% 0.0328 107)
rgb(38 70 83)oklch(37.53% 0.0438 226.2)
rgb(231 111 81)oklch(67.83% 0.1559 35.18)

Other conversions

Was this page useful?