Skip to content
Hex Calculator

OKLCH to Hex Converter

Convert an OKLCH color value back into a 6-digit hex code, with exact round-trip accuracy for CSS oklch() colors and design tokens.

Hex result
#2563EB

How OKLCH to Hex Conversion Works

OKLCH's chroma and hue are polar coordinates around Oklab's a and b axes, so the first step converts them back to Cartesian form. From there, the reverse of the Oklab transform produces linear-light RGB, which gets gamma-encoded into standard sRGB and rounded to the 0-255 integers a hex code represents.

OKLCH to Hex Example, Step by Step

oklch(54.6% 0.2152 262.9) = #2563EB

oklch(54.6% 0.2152 262.9) = #2563EB

a = C x cos(H) = 0.2152 x cos(262.9°) = -0.0267
b = C x sin(H) = 0.2152 x sin(262.9°) = -0.2135

Oklab(0.546, -0.0267, -0.2135) -> linear RGB -> sRGB

Round to bytes: R=37, G=99, B=235 -> #2563EB
StepDescriptionResult
Convert polar to Cartesiana = C·cos(H), b = C·sin(H)a=-0.0267, b=-0.2135
Convert Oklab to linear RGBapply the inverse Oklab matrixlinear R, G, B
Apply sRGB gamma encodingconvert linear values to standard sRGBR=37, G=99, B=235
Convert to hexround and pair each channel#2563EB

This exactly reverses the hex-to-OKLCH example — the two tools are precise inverses of each other for in-gamut colors.

Common Mistakes With OKLCH to Hex

  • Entering chroma as a percentage — chroma in OKLCH is an unbounded decimal (typically 0-0.4), not a 0-100% value like lightness.
  • Expecting every OKLCH value to map to a valid hex — very high-chroma values can fall outside what sRGB screens can display and get clamped.
  • Forgetting hue wraps at 360° — a value like 400° is equivalent to 40°.

Frequently Asked Questions

How do you convert OKLCH to hex?

Convert the polar chroma and hue back into Oklab's Cartesian a and b coordinates, then run the Oklab-to-linear-RGB matrix transform in reverse, and finally re-apply sRGB gamma encoding to get 0-255 channel values.

What format does this tool accept for OKLCH input?

Either plain space-separated values (54.6% 0.2152 262.9) or a full oklch() function string (oklch(54.6% 0.2152 262.9)) — both work the same.

Does OKLCH to hex round-trip exactly?

Yes — oklch(54.6% 0.2152 262.9) converts back to exactly #2563EB, with no drift, as long as the OKLCH value itself came from a hex-to-OKLCH conversion without manual rounding.

What happens if I enter an OKLCH color outside the sRGB gamut?

High-chroma OKLCH values can represent colors sRGB screens can't display. This tool clamps the result to the nearest valid 0-255 RGB value rather than producing an invalid hex code.

Can I use negative or over-360 hue values?

Hue is treated as a circular value 0-360; this tool normalizes hue angles outside that range automatically.