XYZ to HEX and RGB converter
Good for colorimeter readings or research data given in XYZ that you want to see as a 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
- Enter x value, y value (relative luminance) and z value.
- The result appears straight away and updates as you edit.
- Copy the result, or copy a link that keeps the same values to share it.
How it is calculated
R = 3.24097X − 1.53738Y − 0.49861Z, G = −0.96924X + 1.87597Y + 0.04156Z, B = 0.05563X − 0.20398Y + 1.05697Z (after dividing by 100). Linear RGB is then encoded per IEC 61966-2-1: 12.92 l if l ≤ 0.0031308, else 1.055 l^(1/2.4) − 0.055, times 255 and rounded.
Example
Inputs: X value = 41.24, Y value (relative luminance) = 21.26, Z value = 1.93. Result: HEX code: #FF0000; Gamut status: Inside the sRGB gamut.
Limits and caveats
- Assumes values relative to D65 with white at Y = 100; D50 data needs chromatic adaptation first.
- Colors outside sRGB have their channels clipped to 0-255, which shifts the displayed color.
Questions about this tool
My XYZ values run from 0 to 1. What do I do?
Multiply them by 100 before entering them, since the tool expects white to have Y = 100.
Why is my color out of gamut?
Many real XYZ values, such as saturated spectral colors, sit outside the sRGB triangle, which gives a channel below 0 or above 255.
Can I use it for D50 readings?
Not directly, because the matrix is built on D65. Adapt the readings to D65 first, or use Lab with the D50 white.
