HEX to XYZ converter

XYZ is the space every colorimetric conversion passes through, and its Y value is the relative luminance of the color.

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.
  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). Values are shown on a 0-100 scale, with x = X/(X+Y+Z) and y = Y/(X+Y+Z).

Example

Inputs: HEX color code = #1E88E5. Result: XYZ values (D65): X 23.4805, Y 23.5402, Z 77.4375; X: 23.4805; Y (relative luminance): 23.5402.

#1E88E5
X 23.4805, Y 23.5402, Z 77.4375

Limits and caveats

  • HEX and RGB are assumed to be sRGB; Display P3 or Adobe RGB colors need their own ICC profile.
  • For black, the D65 white chromaticity is shown because x and y are undefined at zero.

Questions about this tool

Why is white X = 95.0456 and not 95.047?

The matrix is derived from the D65 chromaticity in the sRGB standard (0.3127, 0.3290). The 95.047 figure comes from ASTM E308 tables and differs slightly.

How does Y relate to contrast?

Y divided by 100 is the relative luminance used in the WCAG contrast ratio formula.

Can I get XYZ relative to D50?

This tool gives XYZ relative to D65, the sRGB white. For D50 values use HEX to Lab with the D50 option.