RGB to CIE XYZ Color Converter

Convert sRGB colors to the CIE XYZ tristimulus color space

Convert sRGB or hex colors to CIE XYZ tristimulus values under the D65 illuminant, including chromaticity coordinates. The foundation for Lab, Luv, and device-independent color work. Runs in your browser. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

What are CIE XYZ tristimulus values?

CIE XYZ is a device-independent color space defined by the CIE in 1931 that models human color perception. X, Y, and Z are tristimulus values, with Y representing luminance. Almost every other perceptual space, including Lab, Luv, and Oklab, is derived from XYZ.

Convert sRGB to CIE XYZ

CIE XYZ is the master color space from which nearly all perceptual color math descends. Converting an sRGB or hex value into XYZ tristimulus values is the first step toward Lab, Luv, color-difference (Delta-E) calculations, and device-independent color management. This converter handles the gamma linearization and the standard D65 matrix for you, and also reports chromaticity coordinates.

Why XYZ matters

XYZ was designed by the CIE in 1931 to represent how the average human observer perceives color. It is device-independent: unlike sRGB, it does not describe what a monitor should do — it describes what the eye actually sees. Nearly every modern color pipeline passes through XYZ at some point:

  • Lab / Luv: derived from XYZ by a cube-root approximation that makes the space more perceptually uniform
  • Oklab and Oklch: built on a linear-XYZ foundation with improved hue-angle accuracy
  • Delta-E color difference: computed in Lab, which comes from XYZ
  • ICC color profiles: store the primaries and white-point in XYZ-relative terms

How it works

Each sRGB channel is first scaled to 0–1 and linearized: values at or below 0.04045 are divided by 12.92, and higher values follow ((c + 0.055) / 1.055) ^ 2.4. The linear R, G, B vector is then multiplied by the standard sRGB-to-XYZ matrix for the D65 white point:

X = 0.4124564*R + 0.3575761*G + 0.1804375*B
Y = 0.2126729*R + 0.7151522*G + 0.0721750*B
Z = 0.0193339*R + 0.1191920*G + 0.9503041*B

The result is multiplied by 100 so the reference white sits at Y = 100.

Worked example and what to watch for

White #ffffff converts to approximately X = 95.05, Y = 100.00, Z = 108.88 — exactly the D65 reference white. A pure red #ff0000 gives roughly X = 41.24, Y = 21.27, Z = 1.93, showing that red contributes little to luminance (Y) and almost nothing to Z.

Note that Y is luminance, so two colors with the same Y appear equally bright even if they look like different hues. The chromaticity pair x = X/(X+Y+Z) and y = Y/(X+Y+Z) strips out brightness entirely — these are the coordinates plotted on the familiar horseshoe-shaped CIE 1931 diagram used for comparing displays and light sources.

Common mistakes to avoid:

  • Skipping linearization before the matrix multiply gives systematically wrong results — gamma-encoded sRGB values are not proportional to physical light.
  • Using a D50 matrix instead of D65 (the correct sRGB white point) shifts every output value, which matters for ICC profile work.
  • Feeding XYZ values scaled to 1 (instead of 100) into a Lab formula without adjusting the divisors produces Lab values that are numerically wrong.

To feed these values into a Lab conversion, keep them on the Y = 100 scale and divide each by the D65 reference white before applying the Lab cube-root function.