AZ Tools

Wavelength to Color Converter (nm → sRGB)

Color

Drag the slider or click anywhere on the rainbow bar to pick a wavelength between 380 nm (violet) and 780 nm (red), and see the matching sRGB approximation as hex / rgb() / hsl(). The bar is rendered as a continuous CSS gradient by sampling 81 wavelengths through Dan Bruton's well-known piecewise polynomial fit to the CIE 1931 color matching functions, with intensity rolloff near the spectrum edges where rods/cones become less sensitive. Underneath is a reference table of Fraunhofer lines — the dark absorption lines Joseph von Fraunhofer catalogued in the solar spectrum in 1814 — including hydrogen-α (Hα, 656.3 nm), the sodium D doublet, the magnesium b line, and the Ca II H and K lines used in spectroscopy and stellar classification.

Wavelength555 nm
BandGreen
Hex
#b3ff00
RGB
rgb(179, 255, 0)
HSL
hsl(78, 100%, 50%)
Visible spectrum (click anywhere to pick wavelength)
380500650780
Fraunhofer reference lines (click to pick)
A759.4 nmO₂ (telluric)
B686.7 nmO₂ (telluric)
C / Hα656.3 nmHydrogen
D₁ (Na)589.6 nmSodium
D₂ (Na)589 nmSodium
E527 nmIron
b₁ (Mg)518.4 nmMagnesium
F / Hβ486.1 nmHydrogen
G / Hγ434 nmHydrogen / Ca / Fe
H (Ca II)396.8 nmCalcium
K (Ca II)393.4 nmCalcium

RGB mapping uses Dan Bruton's piecewise approximation to the CIE 1931 color matching functions with intensity rolloff. sRGB has a smaller gamut than the visible spectrum — pure monochromatic colors are out-of-gamut and shown as the closest sRGB match.

How to use

  1. Drag the slider, or click directly on the spectrum bar to pick a wavelength.
  2. Read the resulting sRGB color in hex, rgb() and hsl() formats — copy any with one click.
  3. Click any row in the Fraunhofer line table to jump to that specific wavelength (e.g. hydrogen-α at 656 nm or sodium D at 589 nm).

Frequently asked questions

Why does the color look dim or washed out near the edges?
The human eye barely sees wavelengths below ~420 nm or above ~700 nm — the long/short cone responses fall off rapidly. The conversion applies an intensity rolloff in those regions to match that perceptual fade, so a 'pure 380 nm' color is rendered as a dim violet rather than a vivid one.
Is the RGB mapping accurate?
It's a useful approximation, not a colorimetric reference. The piecewise function captures the hue progression of the visible spectrum well, but sRGB has a smaller gamut than the visible spectrum — many monochromatic colors (especially deep cyan/teal around 480–500 nm) physically cannot be reproduced on a screen. The shown color is the closest in-gamut approximation.
What are Fraunhofer lines?
Dark gaps in the solar spectrum caused by elements in the Sun's atmosphere absorbing specific wavelengths. Joseph von Fraunhofer catalogued ~570 of them in 1814 using a prism, and labelled the strongest ones A–K. They're now the standard reference wavelengths for spectroscopy and stellar classification — the D lines at 589 nm, for example, are the same yellow you see from a sodium street lamp.
What about ultraviolet and infrared?
UV (below 380 nm) and IR (above 780 nm) are invisible to humans, so they're shown as black. The wavelength selector is capped to the visible range. For a UV blacklight glow, look at the 400–420 nm range — actual UV is below visibility.

Related tools