HEX to Lab converter

Enter a HEX code to get the Lab coordinates that designers and print labs use to describe a color in device-independent terms.

Loading the tool…

Processing and privacy: The result is calculated inside your browser and your data is not sent to any server.

How to use it

  1. Enter hex color code and reference white.
  2. The result appears straight away and updates as you edit.
  3. Copy the result, or copy a link that keeps the same values to share it.

How it is calculated

Each channel c (0 to 1) is linearised per IEC 61966-2-1: c / 12.92 if c ≤ 0.04045, otherwise ((c + 0.055) / 1.055)^2.4. X = 0.41239R + 0.35758G + 0.18048B, Y = 0.21264R + 0.71517G + 0.07219B, Z = 0.01933R + 0.11919G + 0.95053B (matrix derived from the sRGB primaries and D65 white). L* = 116 f(Y/Yn) − 16, a* = 500 (f(X/Xn) − f(Y/Yn)), b* = 200 (f(Y/Yn) − f(Z/Zn)), with f(t) = ∛t if t > 216/24389, else (24389/27 t + 16) / 116. For D50, XYZ is adapted from D65 to D50 with the Bradford matrix first.

Example

Inputs: HEX color code = #FF5733, Reference white = D65 daylight, no adaptation (sRGB white). Result: Lab values: L* 60.18, a* 62.06, b* 54.33; Lightness L*: 60.1758; a* (green to red): 62.0605.

#FF5733
L* 60.18, a* 62.06, b* 54.33

Limits and caveats

  • HEX and RGB are assumed to be sRGB; Display P3 or Adobe RGB colors need their own ICC profile.
  • The second decimal can differ from sites that use a 4-digit rounded matrix or the ASTM white (95.047, 108.883).

Questions about this tool

Should I pick D65 or D50?

D65 is the sRGB white and what most web converters use. D50 is the white of ICC profiles, Photoshop and CSS lab(), so pick it when you compare against those.

What do negative a* and b* mean?

Negative a* leans green and positive a* leans red. Negative b* leans blue and positive b* leans yellow.

Why does another site give slightly different numbers?

Some sites use a rounded matrix or the ASTM white, which moves the second decimal. This tool derives the matrix from the standard chromaticities, so white comes out as exactly L* = 100.