OKLab to HEX Converter
OKLab in, HEX color code out — with the working shown.
To convert OKLab to HEX, normalise the input, convert OKLab back to RGB, write out the HEX value, then check the gamut. For example, oklab(61.82% -0.0391 -0.1895) in OKLab is #2f81f7 in HEX.
This is a free OKLab to HEX converter. Type or paste any OKLab into the field above and the HEX value updates as you type, along with every other notation the web understands. HEX is a six-digit hexadecimal number, two digits per channel, written with a leading #.
Conversions run entirely in your browser using the same color engine as the rest of the site: values round-trip through linear sRGB and CIE XYZ rather than through an approximation, so what you copy is accurate to the last digit the format can carry.
How to convert OKLab to HEX
- Normalise the input. Read the OKLab value and scale each component into the 0–1 range the maths expects.
- Convert OKLab back to RGB. OKLab is not the display's native model, so the first move is always back to red, green and blue.
- Write out the HEX value. Convert back through sRGB and format the result as HEX.
- Check the gamut. Clamp anything that falls outside what an sRGB display can show, so the value you copy is the value you get.
Worked example: oklab(61.82% -0.0391 -0.1895) converts to #2f81f7. That color is Dodger Blue, and the tool above shows each intermediate step for whatever value you enter.
Common OKLab to HEX values
The twenty colors people look up most often, converted from OKLab to HEX. Every row is computed by the same engine as the tool above.
| Color | OKLab | HEX |
|---|---|---|
| White | oklab(100% 0 0) | #ffffff |
| Black | oklab(0% 0 0) | #000000 |
| Red | oklab(62.8% 0.2249 0.1258) | #ff0000 |
| Lime | oklab(86.64% -0.2339 0.1795) | #00ff00 |
| Blue | oklab(45.2% -0.0325 -0.3115) | #0000ff |
| Yellow | oklab(96.8% -0.0714 0.1986) | #ffff00 |
| Cyan | oklab(90.54% -0.1494 -0.0394) | #00ffff |
| Magenta | oklab(70.17% 0.2746 -0.1692) | #ff00ff |
| Silver | oklab(80.78% 0 0) | #c0c0c0 |
| Gray | oklab(59.99% 0 0) | #808080 |
| Maroon | oklab(37.67% 0.1349 0.0755) | #800000 |
| Olive | oklab(58.07% -0.0428 0.1191) | #808000 |
| Green | oklab(51.98% -0.1403 0.1077) | #008000 |
| Purple | oklab(42.09% 0.1647 -0.1015) | #800080 |
| Teal | oklab(54.31% -0.0896 -0.0236) | #008080 |
| Navy | oklab(27.11% -0.0195 -0.1869) | #000080 |
| Orange | oklab(79.27% 0.0566 0.1614) | #ffa500 |
| Pink | oklab(86.77% 0.073 0.0091) | #ffc0cb |
| Gold | oklab(88.68% -0.0169 0.1814) | #ffd700 |
| Crimson | oklab(57.12% 0.2084 0.0762) | #dc143c |
OKLab and HEX, briefly
OKLab is a modern perceptual space with noticeably better hue linearity than CIE Lab. Valid range: L 0–1, a and b roughly −0.4 to 0.4.
HEX is a six-digit hexadecimal number, two digits per channel, written with a leading #. Valid range: #000000 to #ffffff.
Frequently asked questions
How do you convert OKLab to HEX?
1. Read the OKLab value and scale each component into the 0–1 range the maths expects. 2. OKLab is not the display's native model, so the first move is always back to red, green and blue. 3. Convert back through sRGB and format the result as HEX. 4. Clamp anything that falls outside what an sRGB display can show, so the value you copy is the value you get. The converter on this page does all of it as you type, and shows the working underneath.
What is oklab(62.8% 0.2249 0.1258) in HEX?
Pure red, oklab(62.8% 0.2249 0.1258), is #ff0000 in HEX. There is a table of twenty common colors converted to HEX further up this page.
What is oklab(61.82% -0.0391 -0.1895) in HEX?
oklab(61.82% -0.0391 -0.1895) converts to #2f81f7. It is a dodger blue, and you can paste any other value into the field at the top of the page to convert it.
Is OKLab to HEX conversion lossless?
Within sRGB, yes — converting to HEX and back returns the value you started with. The only rounding happens when a component is written out to a fixed number of decimal places.
Can I use HEX directly in CSS?
Yes. #2f81f7 is valid CSS and works in every current browser.
Does this OKLab to HEX converter support transparency?
Alpha is preserved wherever the target notation can carry it — eight-digit hex, rgb() / a, hsl() / a and the modern CSS spaces all round-trip an alpha channel. CMYK has no alpha, so it is dropped there.
Is my color data sent anywhere?
No. Every conversion on this site runs in your browser with no network request, no account and no analytics. You can disconnect and it keeps working.