Oklch to RGB Converter

Convert Oklch lightness/chroma/hue back to sRGB

Ad placeholder (leaderboard)

The Oklch to RGB converter takes a color expressed in the perceptual Oklch space and converts it back to a standard sRGB hex code. Oklch is increasingly used in CSS because it produces smoother gradients and more uniform palettes than HSL, but you still need plain RGB or hex for many tools.

How it works

Oklch is simply Oklab written in cylindrical (polar) coordinates. The conversion proceeds in well-defined steps:

  1. Oklch → Oklab: keep L, and set a = C · cos(H) and b = C · sin(H) with H in radians.
  2. Oklab → nonlinear LMS: multiply by the inverse Oklab matrix M2⁻¹.
  3. Cube each LMS component to undo the cube-root used when building Oklab, giving linear LMS.
  4. Linear LMS → linear sRGB: multiply by the matrix M1⁻¹.
  5. Gamma-encode each linear channel with the sRGB transfer curve and scale to 0–255.

If any channel ends up outside 0–255, the color is outside the sRGB gamut; the tool clamps it and flags the result.

Notes

  • L ranges 0–1, H is in degrees 0–360, and C is typically 0 to about 0.37 for the most saturated sRGB colors.
  • Because Oklch can reach beyond sRGB, the gamut warning tells you when the shown hex is an approximation.

All matrix math runs locally in your browser — nothing is uploaded.

Ad placeholder (rectangle)