HEX to OKLCH Converter
Transform sRGB hex colors into modern perceptually uniform OKLCH (Lightness, Chroma, Hue) with CSS syntax export.
oklch(54.6% 0.215 262.9)
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?
Is OKLCH supported across modern browsers?
What is Chroma in OKLCH?
What happens when an OKLCH color exceeds sRGB boundaries?
Related Design & Color Instruments
HEX to RGB Converter
Convert hexadecimal web color strings (#RRGGBB) to decimal integer rgb(r, g, b) tuples instantly.
RGB to HEX Converter
Convert decimal RGB integer components (0-255) to uppercase 6-digit padded hexadecimal strings.
HEX to HSL Converter
Convert hexadecimal color codes to CSS HSL and HSLA cylindrical coordinates with step-by-step algebraic formula breakdowns.
HSL to HEX Converter
Transform cylindrical HSL coordinates into standardized 6-digit hexadecimal web color strings.