HEX to Lab Converter
HEX color code in, CIE Lab out — with the working shown.
To convert HEX to Lab, normalise the input, linearise the channels, move into the perceptual space, then check the gamut. For example, #2f81f7 in HEX is lab(55.09% 17.34 -65.86) in Lab.
This is a free HEX to Lab converter. Type or paste any hexadecimal color code into the field above and the Lab value updates as you type, along with every other notation the web understands. Lab is a device-independent, perceptually organized space with a lightness axis and two opponent color axes.
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 HEX to Lab
- Normalise the input. Read the HEX value and scale each component into the 0–1 range the maths expects.
- Linearise the channels. Undo the sRGB gamma curve, because the encoded 0–255 numbers are not proportional to light and averaging them directly is what makes gradients go muddy.
- Move into the perceptual space. Convert linear RGB to CIE XYZ under a D65 white point, then apply the Lab transfer function.
- 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: #2f81f7 converts to lab(55.09% 17.34 -65.86). That color is Dodger Blue, and the tool above shows each intermediate step for whatever value you enter.
Common HEX to Lab values
The twenty colors people look up most often, converted from HEX to Lab. Every row is computed by the same engine as the tool above.
| Color | HEX | Lab |
|---|---|---|
| White | #ffffff | lab(100% 0 0) |
| Black | #000000 | lab(0% 0 0) |
| Red | #ff0000 | lab(53.24% 80.09 67.2) |
| Lime | #00ff00 | lab(87.73% -86.18 83.18) |
| Blue | #0000ff | lab(32.3% 79.19 -107.86) |
| Yellow | #ffff00 | lab(97.14% -21.55 94.48) |
| Cyan | #00ffff | lab(91.11% -48.09 -14.13) |
| Magenta | #ff00ff | lab(60.32% 98.23 -60.82) |
| Silver | #c0c0c0 | lab(77.7% 0 0) |
| Gray | #808080 | lab(53.59% 0 0) |
| Maroon | #800000 | lab(25.54% 48.05 38.06) |
| Olive | #808000 | lab(51.87% -12.93 56.67) |
| Green | #008000 | lab(46.23% -51.7 49.9) |
| Purple | #800080 | lab(29.78% 58.93 -36.49) |
| Teal | #008080 | lab(48.25% -28.85 -8.48) |
| Navy | #000080 | lab(12.97% 47.5 -64.7) |
| Orange | #ffa500 | lab(74.94% 23.93 78.95) |
| Pink | #ffc0cb | lab(83.59% 24.14 3.33) |
| Gold | #ffd700 | lab(86.93% -1.92 87.13) |
| Crimson | #dc143c | lab(47.04% 70.92 33.6) |
HEX and Lab, briefly
HEX is a six-digit hexadecimal number, two digits per channel, written with a leading #. Valid range: #000000 to #ffffff.
Lab is a device-independent, perceptually organized space with a lightness axis and two opponent color axes. Valid range: L 0–100, a and b roughly −128 to 127.
Frequently asked questions
How do you convert HEX to Lab?
1. Read the HEX value and scale each component into the 0–1 range the maths expects. 2. Undo the sRGB gamma curve, because the encoded 0–255 numbers are not proportional to light and averaging them directly is what makes gradients go muddy. 3. Convert linear RGB to CIE XYZ under a D65 white point, then apply the Lab transfer function. 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 #ff0000 in Lab?
Pure red, #ff0000, is lab(53.24% 80.09 67.2) in Lab. There is a table of twenty common colors converted to Lab further up this page.
What is #2f81f7 in Lab?
#2f81f7 converts to lab(55.09% 17.34 -65.86). 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 HEX to Lab conversion lossless?
Within sRGB, yes — converting to Lab 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 Lab directly in CSS?
Yes. lab(55.09% 17.34 -65.86) is valid CSS and works in every current browser.
Does this HEX to Lab 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.