Home › Image Tools › OKLCH Color Converter

OKLCH Color Converter

Paste a color in any CSS format and get its OKLCH, OKLab, CIE Lab and LCH values, plus HEX, RGB, HSL and color(display-p3). The gamut check tells you whether the color fits sRGB or Display P3 and gives a chroma-reduced HEX fallback when it does not.

Last updated:

HEX, rgb(), hsl(), hsv(), oklch(), oklab(), lab(), lch(), color(srgb|display-p3 …)

Enter your values to see the result.
Advertisement
Advertisement

How to use the OKLCH Color Converter

  1. Enter a color in any CSS format: #2F6B4F, rgb(47 107 79), hsl(152 39% 30%), oklch(55% 0.2 250) and more.
  2. Pick the precision you want for the output values.
  3. Check the gamut badges. Inside sRGB means the color shows the same on every screen; outside means it needs a fallback.
  4. Copy the value you need, or the two-line CSS fallback for wide-gamut colors.
  5. Build a palette by clicking a swatch in the perceptual lightness scale to copy its HEX.

RGB to OKLab and OKLCH formula

The converter follows Björn Ottosson's OKLab definition and CSS Color Module Level 4:

  1. Linearize sRGB: clin = c / 12.92 if c ≤ 0.04045, else ((c + 0.055) / 1.055)2.4.
  2. To LMS: l = 0.4122 R + 0.5363 G + 0.0514 B, m = 0.2119 R + 0.6807 G + 0.1074 B, s = 0.0883 R + 0.2817 G + 0.6300 B.
  3. Nonlinearity: l′ = ∛l, m′ = ∛m, s′ = ∛s.
  4. To OKLab: L = 0.2105 l′ + 0.7936 m′ − 0.0041 s′, a = 1.9780 l′ − 2.4286 m′ + 0.4506 s′, b = 0.0259 l′ + 0.7828 m′ − 0.8087 s′.
  5. To OKLCH: C = √(a² + b²), H = atan2(b, a) in degrees (0-360).

CIE Lab and LCH are computed from XYZ adapted to the D50 white point with the Bradford transform, matching the CSS lab() and lch() functions.

Reference colors in OKLCH

ColorHEXOKLCHCIE Lab (D50)
White#FFFFFFoklch(100% 0 0)lab(100% 0 0)
Black#000000oklch(0% 0 0)lab(0% 0 0)
Red#FF0000oklch(62.8% 0.258 29.2)lab(54.29% 80.8 69.89)
Lime#00FF00oklch(86.6% 0.295 142.5)lab(87.82% -79.27 80.99)
Blue#0000FFoklch(45.2% 0.313 264.1)lab(29.57% 68.29 -112.03)
Yellow#FFFF00oklch(96.8% 0.211 109.8)lab(97.61% -15.75 93.39)
Mid grey#808080oklch(60% 0 0)lab(53.59% 0 0)

Why designers switch to OKLCH

  • Predictable lightness: two colors with the same L look equally light, which makes contrast and theme scales easier to build than with HSL.
  • Stable hue: lightening or darkening keeps the hue, without the blue-to-purple drift of CIE LCH.
  • Wide gamut: the same syntax reaches Display P3 and Rec. 2020 colors on screens that support them.

Frequently asked questions

What is OKLCH?

OKLCH is the polar form of the OKLab color space created by Björn Ottosson in 2020. L is perceived lightness from 0 to 100%, C is chroma (colorfulness, about 0 to 0.37 for real colors) and H is the hue angle in degrees. Because it is perceptually uniform, changing L by the same amount looks like the same lightness step for every hue.

How do I convert HEX to OKLCH?

Convert the HEX to sRGB, remove the gamma curve to get linear RGB, multiply by Ottosson's first matrix to get LMS cone values, take the cube root, multiply by the second matrix to get OKLab L, a, b, and finally compute C = √(a² + b²) and h = atan2(b, a).

Can I use oklch() in CSS?

Yes. oklch() is supported in all current versions of Chrome, Edge, Firefox and Safari since 2023. For older browsers declare a HEX or rgb() fallback first and the oklch() value on the next line.

What does out of gamut mean?

OKLCH can describe colors that a screen cannot show. If a color is outside sRGB, a standard monitor cannot display it; browsers then map it to the nearest displayable color. Display P3, used by most recent phones and Macs, is about 25% larger than sRGB, so some colors fit P3 but not sRGB.

What is the difference between OKLCH and CIE LCH?

Both use lightness, chroma and hue. CIE LCH is based on CIELAB (1976) and has known problems, for example blue shifting toward purple when lightened. OKLCH fixes those hue shifts and has more even lightness, which makes it better for generating color scales and accessible palettes.

Why does the gamut-mapped HEX look duller?

To fit an out-of-gamut color into sRGB the converter keeps its lightness and hue and lowers only the chroma, which is the method recommended by CSS Color Module Level 4. A naive clip of each RGB channel is also shown; it keeps more saturation but can shift the hue.

Are all the tools on FreeToolCabin tested for quality and accuracy?

Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

Related tools

RGB to HSLConvert RGB values to HSL, HSV and HWB with a live swatch and copy-ready CSS.HEX to RGBConvert HEX colors to RGB and other formats.HSL to HEXConvert HSL and HSLA colors to HEX and RGB with sliders and a live preview.Color Contrast CheckerCheck WCAG contrast ratios and find accessible text colors.Photo Color MatchCopy the color grading of a reference photo onto your image (Reinhard color transfer).Color Palette GeneratorGenerate beautiful color palettes and export them.RGB to HEXConvert RGB to HEX with sliders, live swatch and one-click copy.HEX to HSLConvert HEX colors to HSL and back with interactive sliders.RGB to CMYK ConverterConvert RGB and HEX colors to CMYK for print, and back.Pantone to HEXLook up approximate HEX, RGB and CMYK values for Pantone colors.Color Name FinderFind the closest color name for any HEX or RGB color.Color Blindness SimulatorSee any image as people with protanopia, deuteranopia, tritanopia or achromatopsia see itImage Color PickerPick any pixel colour from an image and get HEX, RGB, HSL plus a paletteColor Shades GeneratorTurn one HEX color into a 50-950 scale plus tints, shades and tones, ready to export.Tailwind Color GeneratorTurn one color into a full Tailwind 50–950 shade scale and export the config or CSS.Color MixerMix two colors in sRGB, linear, OKLab or OKLCH, or blend them with Photoshop-style modes.Random Color GeneratorGenerate random HEX colors one at a time or in batches, with hue, saturation and lightness ranges.Color WheelFind complementary, triadic, analogous and other color harmonies on an interactive wheel.Color PickerPick any color and get HEX, RGB, HSL, HSV and CMYK codes, shades and a screen eyedropper.HTML Color CodesAll 140 HTML color names with HEX and RGB codes, plus the 216 web-safe colors. Click to copy.Color Palette from ImageExtract the main colors of any photo as HEX codes, CSS variables and a palette PNG.Replace Color in ImageClick a color in a picture and swap it for a new color or transparency, keeping the shading.CMYK to RGBConvert CMYK percentages to RGB and HEX color codes with sliders and a live preview.HEX to RGBAConvert HEX color codes to CSS rgba() with an opacity slider and one-click copy.RGBA to HEXConvert rgba() colors to 8-digit HEX, or flatten transparency onto any background.HEX to CMYKConvert HEX color codes to CMYK percentages for print, with a live preview.HEX to PantoneFind the 5 closest Pantone-style solid coated colors for any HEX or RGB, ranked by Delta E.Color Temperature to RGBConvert a color temperature in kelvin (1000-40000 K) to RGB and HEX with a live swatch.RAL to HEXLook up RAL Classic codes as HEX, RGB and CMYK, search by name or find the nearest RAL.Color Code ConverterConvert a color between HEX, RGB, HSL, HSV, CMYK, LAB, LCH and OKLCH with a live swatch.Room Paint Color VisualizerUpload a room photo, select the walls and preview any paint color or HEX with real lighting.Photo to Pop ArtMake Warhol-style pop art from a photo: posterized color tiles in 1, 4 or 9 grids with custom palettes.Screen Color PickerPick any pixel color from anywhere on your screen and copy it as HEX, RGB or HSL.Solid Color Image GeneratorMake a plain single-color or transparent image in any size, like 1920x1080, as PNG or JPG.White Balance CorrectorFix color casts: click a neutral gray point or use auto gray world, then fine-tune temperature and tint.CMYK to HEXConvert CMYK percentages to a HEX color code and RGB, with a live swatch and shades.Underwater Photo Color CorrectionRestore lost reds and remove the blue or green cast from underwater photos by depth.
See all 38 Color Tools →