Skip to content
dz / oklch-to-hex
Design · Color converter

OKLCH to HEX

Paste an oklch() value – the HEX equivalent is listed with every other format, and you can tune L, C and H with sliders.

/color
Adjust
Shades – same hue, OKLCH lightness steps · click to use

WCAG contrast

Normal text – the quick brown fox jumps over the lazy dog.

Large text – 24 px bold

Button / icon outline

What L, C and H mean

  • L – lightness from 0 % (black) to 100 % (white). Unlike HSL it matches perceived brightness, so two colors with the same L look equally light.

  • C – chroma, how colorful it is: 0 is grey, around 0.37 is the most vivid any screen can show.

  • H – hue angle in degrees: roughly 30 red, 90 yellow, 145 green, 260 blue.

Tailwind CSS v4 defines its whole palette in OKLCH – the example above is close to its blue-500.

Why the HEX can be "wrong"

OKLCH can describe colors that sRGB – and therefore HEX – cannot hold, such as the vivid greens of a wide-gamut P3 display. Such a color has to be gamut-mapped: the converter reduces its chroma until it fits and shows that result as HEX and RGB, while the oklch() value keeps the original for screens that can show it.

Questions

Can I use oklch() in CSS directly?

Yes. All current browsers support oklch() (Chrome and Edge 111+, Safari 15.4+, Firefox 113+). Keep a HEX fallback only if you must support older browsers.

Why use OKLCH instead of HSL?

Changing the lightness of an HSL color also shifts how bright it looks unevenly between hues. In OKLCH, equal steps in L look like equal steps, which makes shades and accessible palettes predictable.

How do I convert HEX to OKLCH?

Enter the hex code in the same field – the oklch() value is listed among the formats.

▸ About this tool

About the Color Converter & Contrast Checker

Introduction

The same color can be written in many ways – #3f6b0a, rgb(63 107 10), hsl(87 83% 23%) or oklch(47.7% 0.129 132.5) – and every tool, framework and design file seems to want a different one. This converter reads any CSS color and gives you all common formats at once, lets you fine-tune it with sliders, builds a matching set of shades, and checks whether text in that color is readable according to the WCAG accessibility guidelines.

How to use it

  1. Type or paste a color in any CSS syntax – hex, rgb(), hsl(), hwb(), lab(), oklch() or a name like rebeccapurple. Click the swatch for your system color picker, or use Pick from screen (Chrome and Edge) to grab a color from any window.

  2. Adjust it with sliders in OKLCH, HSL or RGB; the tracks show what each change will look like. Every format on the right updates instantly and has a copy button.

  3. Click a shade (50–950, like Tailwind CSS palettes) to jump to a lighter or darker version of the same hue.

  4. In WCAG contrast, set the background. The ratio, the pass/fail result for every level and a live preview update immediately. If the contrast is too low, one click applies the closest text color that passes AA or AAA.

Short links: develzone.org/color, /hex2rgb, /oklch and /contrast. The address bar always holds the current colors, so a link shares exactly what you see. Pasting a color into the search box on the home page opens it here.

Which format should I use?

  • HEX – compact and universal: design tools, brand guides, older code.

  • RGB – how screens mix light; needed for canvas, image processing and many APIs.

  • HSL – hue, saturation, lightness; intuitive, but its "lightness" is not what the eye sees: yellow and blue at 50 % look very different.

  • OKLCH – lightness, chroma, hue in a perceptual color space (Björn Ottosson, 2020). Equal steps look equal, so changing only the hue keeps the same visual brightness – ideal for design systems, dark modes and generated palettes. It is supported in all modern browsers and used by Tailwind CSS v4. OKLCH can also describe colors beyond sRGB that wide-gamut (Display P3) screens can show; the tool warns you when that happens and shows the closest sRGB fallback.

  • LAB / OKLAB – the color spaces behind color-difference calculations and smooth gradients.

WCAG contrast explained

The Web Content Accessibility Guidelines (WCAG 2.1 / 2.2) measure the contrast ratio between text and background, from 1:1 (identical) to 21:1 (black on white):

  • AA – at least 4.5:1 for normal text and 3:1 for large text (24 px, or 18.66 px bold). This is the level required by most accessibility laws, including the European Accessibility Act and ADA case law.

  • AAA – at least 7:1 for normal and 4.5:1 for large text.

  • Non-text contrast – icons, input borders and focus indicators need 3:1.

The ratio is truncated, never rounded up – 4.499:1 does not pass AA. Semi-transparent text is blended over the background before measuring, because that is the color the reader actually sees.

Privacy

All conversions and checks run in your browser; nothing is sent to a server.

Interesting facts

  • CSS knows 148 named colors. rebeccapurple (#663399) was added in 2014 in memory of Rebecca Meyer, daughter of CSS pioneer Eric Meyer.

  • About 1 in 12 men and 1 in 200 women have a color-vision deficiency – one more reason never to rely on color alone and to keep contrast high.

  • Need to embed an image in CSS instead of a color? Try the Image to Base64 converter.

❯ Esc
↑ ↓ select ↵ open Shift ↵ new line