Wavelength to color
Enter a wavelength of light in nanometres and get two close screen colors for it, in HEX and RGB. The calculation uses the CIE 1931 standard observer, the same data color science is built on.
Wavelength
Most vivid on screen
Channels the screen cannot show are cut to zero, which moves the hue: this swatch’s dominant wavelength is 581 nm.
Same dominant wavelength
White light added until the screen can show it: 13% of the swatch’s luminance. Keeps the CIE hue line, loses saturation.
- Band: yellow
- Brightness to the eye: 87.0% of 555 nm
- CIE xy: 0.5125, 0.4866
How the color is calculated
The CIE 1931 color-matching functions say how strongly the average eye responds to each wavelength, in three values X, Y and Z. Those are converted to linear sRGB with the standard matrix and given the sRGB gamma. A single wavelength always lands outside the sRGB triangle, so one or two of the three channels come out negative; the two swatches are two honest ways of bringing it back in, and the page says which one is which.
The table is the CIE dataset at 1 nm steps, rounded here to six significant figures; between whole nanometres the values are interpolated in a straight line. Both swatches are scaled so the brightest channel is full, which is why deep violet and deep red look far brighter here than the eye sees them in real light.
Wavelength to color: questions
- What color is a given wavelength?
- Type the wavelength in nanometres. The page looks up the CIE 1931 color-matching functions at that wavelength, turns them into the sRGB color space screens use, and shows the result in HEX and RGB. Roughly: below 450 nm violet, 450–485 blue, 485–500 cyan, 500–565 green, 565–590 yellow, 590–625 orange, above 625 red. The borders between names are a convention, not physics.
- Why are there two colors for one wavelength?
- Light of a single wavelength is more saturated than anything an sRGB screen can make, so there is no exact screen color for it. The left swatch cuts the channels the screen cannot show to zero: it is the most vivid, but its hue can shift, in places by tens of nanometres: 520 nm comes out as the green of 549 nm, 650 nm as the red of 611 nm, and the page shows the shifted value under the swatch. The right swatch mixes in white light until the color fits: it keeps the same dominant wavelength on the CIE chart but looks paler. Pick the one that suits your use.
- Why do other wavelength to RGB tools give different values?
- Many of them use a hand-made piecewise formula that draws straight lines between a few chosen colors. This page computes from the CIE 1931 standard observer table at every nanometre instead. Both are approximations of a color a screen cannot show, so neither is “the” RGB of a wavelength; the numbers here can be traced to the published CIE data.
- What does “brightness to the eye” mean?
- It is the CIE luminous efficiency ȳ(λ): how bright light of that wavelength looks compared with the same power at 555 nm, where the eye is most sensitive in daylight. Near 400 or 700 nm it is below 1%, so a laser of those colors looks dim. The swatches are scaled to full brightness and do not show this.
- Can I enter ultraviolet or infrared?
- The CIE table runs from 360 to 830 nm, where the human eye still responds very weakly, so the page stops there. Beyond it ordinary light gives no visible color; only very intense sources, such as lasers, can be seen a little further out.
Sources
- International Commission on Illumination (CIE) (2019). Colour-matching functions of CIE 1931 standard colorimetric observer (dataset), 360–830 nm in 1 nm steps, from CIE 018:2019. Licence CC BY-SA 4.0. DOI