RGB to LAB Converter

Enter an sRGB hex color to convert it to CIELAB (D65) values.

How it is calculated

The tool reads a six-digit sRGB hex code (a leading # is optional, and a three-digit shorthand such as f00 is expanded). Each channel is divided by 255, then linearized: c/12.92 for small values, otherwise ((c+0.055)/1.055)2.4. The linear values are multiplied by the sRGB matrix to get X, Y, Z and divided by the D65 white (95.047, 100, 108.883). Then L* = 116·f(Y) − 16, a* = 500·(f(X) − f(Y)) and b* = 200·(f(Y) − f(Z)), where f(t) is the cube root of t above 0.008856 and a linear segment below it. Results are rounded to two decimals. Any input that is not a valid 3 or 6 digit hex code gives no result.

Worked example

Take the colour 1E6BFF. The channels are 30, 107 and 255, which linearize to about 1.30, 14.70 and 100.00 percent. The matrix gives X ≈ 23.84, Y ≈ 18.01, Z ≈ 96.83. After dividing by the D65 white and applying the cube root, L* = 116 × 0.565 − 16 ≈ 49.5. The tool shows 49.51 32.97 -79.38: moderately light (L*), pushed toward magenta-red (a* positive) and strongly toward blue (b* very negative).

Try this example →

Common mistakes

  • Typing RGB decimals such as 30,107,255 into the box. It expects one hex code, not three separate numbers.
  • Treating L* as a 0 to 255 brightness. It runs from 0 (black) to 100 (white), so a mid blue near 50 is normal.
  • Comparing results with a LAB value measured against D50 (common in print profiles). This tool uses D65, so the numbers will not match.
  • Assuming a* and b* are 0 to 100 as well. They are signed: negative a* is greenish, positive is reddish, negative b* is bluish, positive is yellowish.
  • Expecting pure white to give exactly 0 and 0 for a* and b*. The result shows tiny residuals of about 0.01 because of rounding in the matrix constants.

About this calculator

CIELAB (L*a*b*) is a color space designed to be perceptually uniform — equal numeric distances in L*a*b* correspond much more closely to equal perceived color differences than equal distances in RGB do, which is why it's the standard space for measuring how different two colors actually look to the human eye. Converting sRGB to LAB requires first linearizing and transforming the RGB values into the CIE XYZ color space, then applying the nonlinear XYZ-to-LAB transformation referenced against a chosen white point — here, the common D65 standard illuminant that approximates average daylight.

This calculator runs an sRGB hex color through that full pipeline to produce its L*, a*, and b* coordinates. It's used in color science, print production, and quality control, where LAB values feed into calculating a precise color-difference metric (Delta E) between a target color and a printed or manufactured sample — something RGB or hex values alone can't reliably measure.

Was this helpful?

You can pick up to 3 reactions.

Comments (1)

  • Editorial team

    To compare two colours, run each hex code and take the straight-line distance: the square root of the squared differences in L*, a* and b*. This is the simple CIE76 version of Delta E. Greys 808080 and 828282 give L* of 53.59 and 54.37, a distance of about 0.78, which most people cannot see side by side. Quality-control standards often use the more elaborate CIEDE2000, which this plain distance only approximates. Which two colours are you trying to tell apart?

Popular calculators

All Calculators