OKLCH Color Converter
Color & DesignConvert between hex and OKLCH — the perceptual color space behind modern CSS. Live lightness, chroma, and hue sliders with the sRGB gamut edge shown on the chroma rail; out-of-gamut points gamut-map exactly like browsers do.
#3b82f6What it does
Converts between hex colors and OKLCH — the perceptually uniform color space CSS Color 4 brought to oklch(). Enter a hex and get its L (lightness), C (chroma), H (hue) with live sliders; drag the sliders and get back the hex, the exact CSS string, and the RGB triple. The chroma slider’s readout shows the sRGB gamut edge at your current L and H — drag past it and the color gamut-maps by chroma reduction, exactly the way browsers render out-of-gamut oklch(), with a badge saying so. Everything runs locally in your browser.
How to use it
- Pick a mode: From hex (a color swatch picker) or From oklch() (paste a CSS string like
oklch(62.8% 0.25 29)— percent or 0-1 lightness, optionaldeg, optional alpha). - Adjust Lightness, Chroma, and Hue with the sliders — the result updates live.
- Copy on the result header takes the CSS string; the smaller copy button beside the hex takes the hex.
- Copy share link encodes the exact L/C/H point in the URL.
Examples
Interface blue #3b82f6 parses as oklch(62.3% 0.188 259.8).
Drag Chroma to 0.35 at that hue: the readout shows 0.188 / 0.210 — you’re past the edge. The swatch shows the gamut-mapped color, and the badge flips to gamut-mapped.
In From oklch() mode, paste oklch(70% 0.15 150) — the swatch, hex, and RGB update as you type.
Good to know
- OKLCH is the polar form of OKLab (Björn Ottosson, 2020) — the same math browsers use; hue is a degree, chroma roughly tracks saturation, lightness is perceptual.
- Equal lightness steps look equally bright to humans — the reason design systems use OKLCH for palettes.
- The chroma rail value is found by bisection to ±0.001; the gamut-mapped output never exceeds it.
- Negative or >360 hue input wraps (
-30=330), andLoutside 0-1 clamps to the nearest in-range color.