ColorMay 8, 2026 · Updated Oct 13, 2026 · 3 min read

How to Use OKLCH Colors in CSS (2026)

Why OKLCH beats HSL, measured: fully saturated HSL colors at "50% lightness" differ 12.9-fold in luminance, OKLCH colors at the same L only 1.21-fold. Plus the popular custom-property fallback that does not work, and one that does.

🌈
Try the Color Converter
Free, no signup
→
DG
Derek Giordano
Designer & Developer
In this guide
01Why OKLCH: Measured02Syntax03Practical Uses04Browser Support and a Fallback That Actually Works

Why OKLCH: Measured

In HSL, "lightness" is arithmetic, not perception. We compared the relative luminance (the quantity WCAG contrast is built on) of fully saturated colors at the same HSL lightness, hsl(h 100% 50%), with colors at the same OKLCH lightness, oklch(0.7 0.15 h), every 10° round the hue circle (coloraide, gamut-mapped to sRGB; October 14, 2026):

Colors at "the same lightness"Darkest hueBrightest hueSpread
hsl(h 100% 50%)0.072 (blue)0.928 (yellow)12.9×
oklch(0.7 0.15 h)0.3150.3821.21×

So HSL's 50% blue and 50% yellow differ almost thirteen-fold in luminance, while every OKLCH hue at L 0.7 lands within about 20% of the others. That is what makes OKLCH useful for palettes: change the hue, keep the lightness, and the contrast stays put.

Syntax

oklch(L C H): L is lightness from 0 to 1 (or 0-100%), C is chroma from 0 (grey) up to about 0.32 for the most saturated sRGB color (magenta), higher for wide-gamut colors, H is the hue angle. Alpha follows a slash: oklch(0.7 0.15 145 / 0.5). Relative color syntax derives new colors from a variable, for example oklch(from var(--brand) l calc(c * 0.5) h) for a muted version.

Practical Uses

Browser Support and a Fallback That Actually Works

MDN's compatibility data lists oklch() in Chrome and Edge 111, Firefox 113 and Safari 15.4. A common fallback snippet repeats a custom property: --brand: #3B82F6; --brand: oklch(0.62 0.2 260);. That does not work. Custom properties are not checked when parsed, so the second declaration always wins, and a browser that cannot read oklch() then finds the property "invalid at computed-value time" where it is used, and falls back to the property's inherited or initial value, not to your hex. Put the fallback on the property that uses the color, or use @supports:

.button {
  background: #3B82F6;                    /* older browsers */
  background: oklch(0.62 0.2 260);        /* ignored if not understood */
}
@supports (color: oklch(0 0 0)) {
  :root { --brand: oklch(0.62 0.2 260); }
}

The Color Converter reads oklch() and every other CSS Color 4 syntax and gives the gamut-mapped sRGB hex for fallbacks.

Frequently Asked Questions

What’s the difference between OKLCH and LCH?+
OKLCH improves on LCH by better handling hue uniformity. In LCH, some hue ranges (blues) shift when lightness changes. OKLCH corrects this with an improved perceptual model.
Can I use OKLCH for gradients?+
Yes. OKLCH gradients avoid muddy midpoints. Use <code>background: linear-gradient(in oklch, ...)</code> for perceptually smooth transitions between any two colors.
Is OKLCH harder to use than hex?+
There’s a learning curve, but the benefit is predictability. Once you understand L (brightness), C (saturation), and H (hue), building harmonious palettes becomes more intuitive than guessing hex values.
Try it yourself

Use the Color Converter — free, no signup required.

⚡ Open Color Converter
DG
Derek Giordano
Written by the creator of Ultimate Design Tools. BA in Business Marketing.