OKLCH to HEX

Convert OKLCH colors to HEX as you type, with a live preview, the formula and a table of common colors converted.

loading OKLCH to HEX
About this tool

What are OKLCH and HEX?

OKLCH is the polar form of the Oklab space (2020): perceived lightness, chroma and hue. Equal steps of L look equally lighter, which HSL does not do, and it can reach colors outside sRGB. HEX writes the red, green and blue channels of sRGB as two hexadecimal digits each, from 00 to FF.

Needed when an OKLCH color from modern CSS must go to a tool, an e-mail template or an older browser that only knows HEX; colors outside sRGB are clipped to the nearest one.

The color converter below starts from OKLCH and highlights HEX, next to HWB, LAB, LCH and CSS names.

OKLCH vs HEX

OKLCHHEX
Notationoklch(80.9% 0.163 74.6)#RRGGBB, #RGB, #RRGGBBAA
In CSSChrome 111+, Safari 15.4+, Firefox 113+all browsers
Typical usedesign systems, accessible palettes, wide-gamut screensCSS, design handoff, brand guides

Formula

sRGB channels are linearized (gamma removed), mixed into the LMS cone space, cube-rooted and mixed again into Oklab L, a, b (Björn Ottosson, 2020); OKLCH is the polar form: C = √(a² + b²) and h = atan2(b, a). Going back, a color outside sRGB is clipped to the nearest displayable one. Then: Write each channel (0–255) as two hexadecimal digits and join them: 255 → FF, 178 → B2 (178 = 11 × 16 + 2), 36 → 24, so rgb(255, 178, 36) is #FFB224. Values below 16 need a leading zero (10 → 0A).

What changes in the conversion

  • The conversion is not perfectly reversible: OKLCH can describe colors that sRGB cannot show; they are clipped to the nearest HEX.
  • Transparency (alpha) is kept: #RRGGBBAA, rgb(… / 0.5), hsl(… / 50%) and oklch(… / 0.5) all carry it.

How to convert OKLCH to HEX

  1. Type or paste the OKLCH value in its line, or pick a color with the color picker.
  2. Read the HEX line, which updates as you type, and check the preview swatch.

Common colors from OKLCH to HEX

Converted with the same code as the tool:

ColorOKLCHHEX
amber (stdlib.tools accent)oklch(81.69% 0.1639 75.84)#FFB224
tealoklch(50.9% 0.0875 215.07)#0B7285
blueoklch(62.31% 0.188 259.81)#3B82F6
greenoklch(62.71% 0.1699 149.21)#16A34A
redoklch(57.71% 0.2152 27.33)#DC2626
mid grayoklch(59.99% 0 0)#808080
blackoklch(0% 0 0)#000000
whiteoklch(100% 0 0)#FFFFFF

Frequently asked questions

Is OKLCH to HEX exact?

Close, not exact: rounding and gamut limits apply, as explained above. For brand colors, keep the official value of each format instead of converting back and forth.

Which format should I use in CSS?

HEX and rgb() work everywhere; hsl() is handy for shades written by hand; oklch() gives even lightness steps and wide-gamut colors in current browsers.

How do I write HEX with transparency?

Add two more digits for alpha: #FFB22480 is the amber at 50% opacity (80 hex = 128 of 255).

Report a problem