Hex to OKLCH Converter

Convert hex codes to OKLCH for modern CSS and Tailwind v4, with RGB, HSL and CMYK values alongside.

Enter a valid Hex value, like #3B82F6

  • OKLCH
  • RGB
  • HSL
  • CMYK

How hex to OKLCH conversion works

It takes four steps. The hex code is turned into RGB, then into linear light, then into the OKLab color space, then into polar form:

1. #3B82F6 → rgb(59, 130, 246)
2. Remove the sRGB gamma curve
3. Multiply into OKLab: L, a, b
4. C = √(a² + b²), H = atan2(b, a)

For #3B82F6, Tailwind v3's blue-500, that gives oklch(62.3% 0.188 259.8). Values are rounded to one decimal for L and H and three for C, which is more precise than anyone can see.

Common colors in OKLCH

ColorHexOKLCH
White#FFFFFFoklch(100% 0 0)
Black#000000oklch(0% 0 0)
Red#FF0000oklch(62.8% 0.258 29.2)
Orange#FFA500oklch(79.3% 0.171 70.7)
Yellow#FFFF00oklch(96.8% 0.211 109.8)
Green#008000oklch(52% 0.177 142.5)
Blue#0000FFoklch(45.2% 0.313 264.1)
Purple#800080oklch(42.1% 0.193 328.4)
Pink#FFC0CBoklch(86.8% 0.074 7.1)
Gray#808080oklch(60% 0 0)

Questions

How do I convert hex to OKLCH?

Paste the hex code above and the OKLCH value appears instantly, ready to paste into CSS. The hex goes through linear RGB and the OKLab color space, then lightness, chroma and hue are read from that.

What do the three OKLCH numbers mean?

L is lightness from 0% (black) to 100% (white). C is chroma, how colorful it is, from 0 (gray) to about 0.37 at most. H is the hue angle from 0 to 360.

Why use OKLCH instead of HSL?

OKLCH lightness matches how bright a color looks. In HSL, yellow and blue at 50% lightness look very different. In OKLCH they look about the same, which makes color scales and accessible contrast easier to get right.

Does Tailwind use OKLCH?

Yes. Tailwind CSS v4 defines its whole default palette in OKLCH, so converting brand colors to OKLCH keeps them consistent with the rest of a v4 theme.

Do all browsers support oklch()?

Yes, every current version of Chrome, Safari, Firefox and Edge supports oklch(). For very old browsers, keep a hex fallback above it.

More free tools

Landings
Landing Page Examples
Copyright © 2026. All rights reserved.