Why OKLCH makes lightness easy to compare
OKLCH splits a color into lightness, chroma and hue along axes tuned to how the eye actually responds. Unlike HSL, two colors with the same lightness value really do look about equally bright, which makes stepped palettes and dark-mode pairings far simpler to reason about. This converter turns a HEX code into an oklch() value and turns an oklch() value back into HEX.
The math uses the OKLab reference coefficients published by Björn Ottosson together with the sRGB linearization from the W3C CSS Color specification. The linearization threshold is 0.04045, and the reverse direction inverts the same matrices numerically so the round trip stays exact. Colors with chroma near zero have no defined hue and are reported as 0. This reflects October 2026.
OKLCH can describe colors wider than sRGB, so some combinations have no HEX equivalent. Rather than clamping quietly, the tool reports which channel overshoots and by how much alongside the clamped approximation. HSL and HSB conversion and palette generation are not supported here; separate tools cover those.
Frequently asked questions
Hue is mathematically undefined when chroma is zero. The arctangent in the formula returns a meaningless angle from floating-point noise, so a near-zero chroma is reported as hue 0 and labeled achromatic.
OKLCH can describe colors that sRGB cannot hold, so some combinations have no HEX equivalent. This tool does not clamp them quietly: it reports how far each channel overshoots and what you will actually see.
This page is OKLCH only. HEX, RGB and HSL conversions are handled by the Simplewoody color converter, and HSB has its own HEX to HSB converter.