🔁 OKLCH to HEX Converter
Convert an oklch() value to a safe HEX and RGB fallback — with a clear flag when the color is too vivid for the sRGB screen.
#ff0001
⚠ Out of sRGB gamut — chroma reduced for this HEX fallback
oklch(62.8% 0.2576 29.2)oklab(62.8% 0.2250 0.1256)lab(53.24 80.10 66.95)lch(53.24 104.39 39.9)hwb(360 0% 0%)#ff0001rgb(255, 0, 1)hsl(360, 100%, 50%)Exact OKLab matrices (Björn Ottosson) + CIE XYZ/LAB (D65). Out-of-gamut OKLCH colors are chroma-mapped along constant L and H. 🔒 Computed in your browser.
How the oklch to hex converter works
The OKLCH value is converted to OKLab, then inverted through the OKLab matrices back to linear-sRGB and gamma-encoded to HEX/RGB. If the color falls outside sRGB, the tool reduces chroma while holding lightness and hue (the CSS Color 4 gamut-mapping method) so the HEX fallback is always displayable, and it tells you when this happened.
This is the conversion that makes OKLCH practical: you author in oklch() but still need a HEX fallback for older browsers and tools — and you need to know when a beautiful wide-gamut color will be dulled on an sRGB screen.
Frequently asked questions
How do I convert OKLCH to HEX?
Enter the OKLCH lightness, chroma and hue; the tool inverts the OKLab matrices to sRGB and outputs the HEX and RGB. If the color is out of the sRGB gamut, it maps it to the nearest displayable HEX and flags it.
What does "out of gamut" mean here?
OKLCH can express colors more saturated than sRGB can display. When that happens the exact HEX does not exist, so the tool lowers chroma (keeping lightness and hue) until the color fits and shows a warning — giving you an honest, usable fallback.
Why do I need a HEX fallback if I use OKLCH?
A small share of browsers and many design or email tools still expect HEX. Providing a HEX fallback alongside oklch() keeps your colors correct everywhere while you author in the modern space.
Is the OKLCH→HEX conversion lossy?
Only when the OKLCH color is outside sRGB — then gamut mapping changes the chroma slightly. For in-gamut colors the conversion is exact and round-trips back to the same OKLCH.
Does it accept OKLAB too?
Yes — you can enter an OKLAB (L, a, b) color as well, and it converts through the same inverse matrices to HEX and RGB.