RGB to XYZ converter

It linearises the sRGB channels and applies the RGB to XYZ matrix, the first step of most color science work.

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 red r, green g and blue b.
  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). Results are shown on a 0-100 scale.

Example

Inputs: Red R = 30, Green G = 136, Blue B = 229. Result: XYZ values (D65): X 23.4805, Y 23.5402, Z 77.4375; X: 23.4805; Y (relative luminance): 23.5402.

Limits and caveats

  • HEX and RGB are assumed to be sRGB; Display P3 or Adobe RGB colors need their own ICC profile.
  • Values are relative, scaled so white Y = 100, not absolute luminance in cd/m².

Questions about this tool

Why not apply the matrix to RGB directly?

sRGB values are gamma encoded, so they must be linearised first, otherwise XYZ comes out wrong.

What do x and y mean?

Chromaticity coordinates describe hue and saturation without lightness, and are plotted on the CIE 1931 diagram.

Why is pure green exactly x 0.3, y 0.6?

Those are the green primary coordinates defined by the sRGB standard, so the result confirms the matrix.