Convert any OKLCH color to RGB, HEX, and HSL instantly — paste a value or drag the sliders, no signup required.
How the OKLCH to RGB Conversion Formula Works
Converting OKLCH to RGB takes four steps: OKLCH becomes OKLab, OKLab becomes linear sRGB, linear sRGB is gamma-encoded, then scaled to 0–255.
Step 1 — OKLCH to OKLab. OKLCH stores color as Lightness (L), Chroma (C), and Hue (H) — a polar version of OKLab. Converting back to OKLab’s rectangular a/b coordinates uses basic trigonometry:
a = C × cos(H)
b = C × sin(H)
L carries over unchanged.
Step 2 — OKLab to linear sRGB. This step runs through an intermediate LMS color space (modeling how the eye’s cone cells respond to light). L, a, and b are combined into three LMS-like values, each cubed, then multiplied through a fixed 3×3 matrix to produce linear red, green, and blue:
l_ = L + 0.3963377774×a + 0.2158037573×b
m_ = L − 0.1055613458×a − 0.0638541728×b
s_ = L − 0.0894841775×a − 1.2914855480×b
l = l_³, m = m_³, s = s_³
R_linear = 4.0767416621×l − 3.3077115913×m + 0.2309699292×s
G_linear = −1.2684380046×l + 2.6097574011×m − 0.3413193965×s
B_linear = −0.0041960863×l − 0.7034186147×m + 1.7076147010×s
Step 3 — Gamma encoding. Linear RGB isn’t what screens display directly. Each channel is gamma-encoded to standard sRGB using a piecewise curve:
if channel ≤ 0.0031308:
output = channel × 12.92
else:
output = 1.055 × channel^(1/2.4) − 0.055
Step 4 — Scale to 0–255. Each 0–1 channel is multiplied by 255 and rounded to the nearest whole number, producing the final rgb() value.
Because OKLCH can represent a wider range of colors than sRGB screens can display, some OKLCH values fall outside the sRGB gamut. When that happens, the calculated RGB channel exceeds 0–1 before rounding — the converter above flags this and clamps the result to the closest color a screen can actually show.
When You’d Convert OKLCH to RGB
- Browser fallback support. OKLCH is supported in all modern browsers, but older browsers or email clients that only understand
rgb()/hexstill need a fallback value generated from the same color. - Design handoff. Designers working in OKLCH-based tools (or newer Figma/CSS workflows) often need to hand developers an RGB or HEX equivalent for legacy systems, style guides, or non-CSS contexts like image editing software.
- Working with WordPress block themes.
theme.jsoncolor palettes and many page builder color pickers still expect HEX or RGB values — converting an OKLCH brand color from a design system into atheme.json-ready HEX value is a common one-off task.
FAQ
How do I convert OKLCH to RGB?
Enter or paste the OKLCH value into the converter above — it runs the value through OKLab and linear sRGB automatically and displays the matching RGB, HEX, and HSL equivalents instantly.
What’s the OKLCH to RGB conversion formula?
The formula converts OKLCH to OKLab using trigonometry, OKLab to linear sRGB using a fixed matrix multiplication, then gamma-encodes and scales the result to 0–255 — the full step-by-step math is broken down above and inside the tool’s “Show the math” panel.
Why does my converted RGB look different from the OKLCH color I expected?
This usually means the OKLCH value is outside the sRGB gamut — OKLCH can address colors, especially highly saturated ones, that standard screens and the rgb() color space can’t display, so the converter clamps to the nearest displayable color and flags it as out of gamut.
Is OKLCH to RGB conversion lossy?
For colors inside the sRGB gamut, the conversion is effectively lossless aside from standard rounding to 8-bit channels; for out-of-gamut colors, some color information is lost during clamping since sRGB physically can’t reproduce the original color.
Do browsers support OKLCH directly, or do I need to convert it?
All major modern browsers support oklch() natively in CSS, but converting to RGB/HEX is still useful for older browser fallbacks, email HTML, non-CSS design tools, and any system that only accepts legacy color formats.
