opyeb ColorOKLCH

15 guides · Foundations

OKLab and OKLCH — one space, two coordinate systems

Basis 28 November 2026 · Foundations · about 7 min

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

When OKLCH is the right tool

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.

TaskBetter coordinatesWhy
Step paletteOKLCHfixed hue, moving lightness
Colour differenceOKLabEuclidean distance
Gradient interpolationOKLaba straight path looks natural
Finding a complementOKLCHadd 180 to H
Contrast correctionOKLCHkeep 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 tool

Basis 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