OKLab and OKLCH — one space, two coordinate systems
OKLab and OKLCH are not different colour spaces; they are two coordinate systems for the same space. OKLab uses L (lightness), a (green to red) and b (blue to yellow). OKLCH expresses the same point as lightness L, chroma C and hue H. It is the difference between Cartesian and polar coordinates.
The conversion
C = √(a² + b²)
H = atan2(b, a) × 180 ÷ π
a = C × cos(H × π ÷ 180)
b = C × sin(H × π ÷ 180)
That is the whole conversion. Internally the calculator goes through OKLab, multiplies by the linear sRGB matrix to get a colour, and converts back to C and H for display. Nothing is lost between the two forms apart from floating-point noise.
When OKLab is the right tool
- Comparing two colours as a number: ΔE = √(ΔL² + Δa² + Δb²)
- Blending or interpolating: straight-line interpolation is natural
- Gamut mapping by minimum distance: Euclidean distance to the source colour
- Clustering a palette: k-means works on the rectangular coordinates
When OKLCH is the right tool
- Step palettes: fix hue and move lightness
- Chroma adjustment: change vividness at a constant hue
- Hue rotation: find complements and analogues by adding to an angle
- Contrast correction: keep C and H and move only L
A common mistake is mixing the two. Pick a colour in OKLCH in a design tool, then write the OKLab numbers into code, and the colour looks close but every chroma is slightly off. Choose one representation as the source of truth for a project and use the other only inside calculations.
What perceptual uniformity buys you
The main advantage of OKLab is perceptual uniformity: the same L difference looks like the same brightness difference on screen, and the same C difference looks like the same saturation difference. That property is why “raise L by ten points” is a predictable operation across hues. CIELAB aimed at the same goal, but its hue rotates in the blue region; OKLab is steadier there.
Uniformity is not perfect. Below L 10% chroma changes are hard to see, and at very high chroma hue wobbles slightly. That is why the calculator re-checks the gamut at every step: a mathematically even formula does not guarantee an even result on a display. Judge the final palette on screen.
| Task | Better coordinates | Why |
|---|---|---|
| Step palette | OKLCH | fixed hue, moving lightness |
| Colour difference | OKLab | Euclidean distance |
| Gradient interpolation | OKLab | a straight path looks natural |
| Finding a complement | OKLCH | add 180 to H |
| Contrast correction | OKLCH | keep C and H, move L |
Conversion coefficients follow Ottosson's OKLab publication and CSS Color 4.
Questions
How is OKLab different from CIELAB?
Both aim at perceptual uniformity, but OKLab reduces the hue rotation in blue and is cheaper to compute. Being usable directly in CSS matters in practice.
Can chroma be negative in OKLCH?
Mathematically yes, but CSS clamps it to zero. Rotating hue by 180° has the same effect.
Can I compare two colours in OKLCH?
Subtracting L, C and H separately distorts hue differences. Use the Euclidean distance in OKLab.
The tool converts through OKLab and displays OKLCH; see it in the palette tab.
Open the toolBasis date 28 November 2026. Written against the W3C specifications, the APCA documentation and published browser support tables; updated when they change.
Back to the guides