GamutDesk Logo
GamutDesk

HEX to OKLCH Converter

Transform sRGB hex colors into modern perceptually uniform OKLCH (Lightness, Chroma, Hue) with CSS syntax export.

Client-Side ArchitecturePrivate Client-Side Processing
#2563EB
Modern CSS OKLCH String
oklch(54.6% 0.215 262.9)
Lightness (L)0.54654.6%
Chroma (C)0.215
Hue (H)262.9°
Cartesian OKLab:oklab(0.546, -0.027, -0.214)

Technical Specification & Mathematical Principles

Mathematical Transformation: sRGB to OKLCH Coordinates

Converting an sRGB HEX string to OKLCH coordinates involves linearizing sRGB channels, mapping to human cone responses via the M1 matrix, applying cube-root non-linear compression to obtain Cartesian OKLab (L, a, b), and projecting into cylindrical polar coordinates:

Chroma (C) = √(a² + b²)
Hue (H) = atan2(b, a) × (180 / π)  [normalized to 0°–360°]

Understanding Gamut Mapping: OKLCH Beyond sRGB Boundaries

OKLCH can represent the full visible spectrum, including wide-gamut colors in Display P3 and Rec. 2020 that standard sRGB monitors cannot physically emit. When a wide-gamut OKLCH declaration is rendered on an sRGB screen:

  • W3C CSS Color 4 Gamut Mapping: Modern browsers perform binary-search chroma reduction. Rather than naively clipping channels (which causes harsh hue distortions), the browser holds Lightness (L) and Hue (H) constant while gradually lowering Chroma (C) until the coordinate falls inside the sRGB gamut triangle.
  • Predictable Perceptual Uniformity: Because Lightness remains constant during gamut mapping, UI components maintain consistent contrast against backgrounds regardless of whether the user views the page on a standard laptop or a wide-gamut OLED mobile display.

Related Conversion & Contrast Tools

Compare cylindrical models with our RGB to HSL Converter, or verify your converted OKLCH palette contrast using our WCAG Color Contrast Checker.

Frequently Asked Questions

What makes OKLCH superior to HSL for design systems?
Unlike HSL, where 50% lightness in yellow appears far brighter than 50% lightness in blue, OKLCH is designed to provide more perceptually uniform lightness behavior across different hues.
Is OKLCH supported across modern browsers?
Yes, OKLCH is natively supported in all modern evergreen browsers (Chrome 111+, Safari 15.4+, Firefox 113+, Edge 111+) and is the official color standard for Tailwind CSS v4.
What is Chroma in OKLCH?
Chroma represents the purity or saturation of the color. In sRGB displays, Chroma ranges approximately from 0.0 (neutral gray) up to ~0.37 for intense saturated colors.
What happens when an OKLCH color exceeds sRGB boundaries?
Browsers apply gamut mapping by reducing Chroma while holding Lightness and Hue constant until the color fits inside the destination sRGB or Display P3 monitor gamut.

Related Design & Color Instruments