Wavelength to Color Converter
What color is light of a given wavelength, and how bright does it look? The converter takes a vacuum wavelength and returns the color name, the nearest sRGB screen color as a hex code, the CIE 1931 chromaticity, the eye’s daylight and night sensitivity, and the photon energy, using the CIE tables at 1 nm. Background: visible light, radiometry and photometry and photon energy.
Two short experiments. Each one sets the inputs, says where to look, and asks for a prediction before it shows the result.
These checks run in your browser on every load. The tables, the chromaticity, the sRGB conversion and the photon energy are compared with the CIE values and with values worked out by hand.
| Check | Expected | Computed | Tolerance |
|---|
The expected values are CIE 1931 and CIE 1951 table entries at whole nanometers, chromaticities from them, the IEC 61966-2-1 sRGB encoding, and E = hc/λ with the exact SI constants. The tolerance is the largest difference from Expected that still passes, relative to Expected or to 1, whichever is larger.
A monochromatic light of unit power at wavelength has CIE 1931 tristimulus values equal to the color-matching functions at that wavelength,
and is the photopic luminous efficiency . The screen color comes from the sRGB matrix of IEC 61966-2-1,
followed by the sRGB gamma encoding. Every spectral color lies on the horseshoe of the chromaticity diagram, outside the sRGB triangle, so at least one channel comes out negative. Clipping sets it to zero, which moves the color to the triangle’s edge and slightly changes its hue; adding white raises all three channels equally until none is negative, which keeps the line from the D65 white point to the spectral color (its dominant wavelength) at the cost of saturation. The largest channel is then scaled to 1, so the swatch shows the hue at full brightness; the efficiency and the luminous efficacy lm/W say how bright one watt of it actually looks. The tables are those of the CIE 1931 2° observer and the CIE 1951 scotopic observer from 380 to 780 nm, linearly interpolated between whole nanometers; the color names follow common band edges, which vary by a few nanometers between sources.
Worked example
At 532 nm the tables give , chromaticity . The red channel is negative; clipping gives #00ff00, the full green of the screen. One watt at 532 nm is 604.4 lumens in daylight, and the photon energy is 2.3305 eV. At 450 nm , so a blue laser of the same power looks about 23 times dimmer.
Related: the lumens to watts converter uses the same CIE tables, the wavelength calculator converts between wavelength, frequency and energy, and the electromagnetic spectrum entry places the visible band among the others.
References: ISO/CIE 11664-1:2019, Colorimetry, part 1: CIE standard colorimetric observers. CIE 015:2018, Colorimetry, 4th ed. IEC 61966-2-1:1999, Multimedia systems and equipment: colour measurement and management, part 2-1: default RGB colour space, sRGB. G. Wyszecki and W. S. Stiles, Color Science, 2nd ed., Wiley (1982).