What the color codes mean
Every code above describes the same color in a different coordinate system. Some describe the signal sent to a display; others describe what a standard observer sees.
| Code | What it encodes | Device-independent? | Typical use |
|---|---|---|---|
| HEX | The three sRGB channel values (0–255) written in base 16: #RRGGBB, or #RGB as shorthand for #RRGGBB. | Only through sRGB | Web and software colors |
| RGB | Red, green, and blue drive levels, gamma-encoded. #3366CC is R 51, G 102, B 204. | Only when the space is named (sRGB, Adobe RGB, Display P3); camera RGB depends on the sensor | Displays, cameras, image files |
| HSV / HSB | RGB rearranged as a cylinder: hue angle, saturation, and value (the largest channel). | No, inherits RGB | Color pickers, simple machine-vision thresholds |
| HSL | Like HSV, but lightness is the average of the largest and smallest channels, so the purest hues sit at L = 50 % and white at 100 %. | No, inherits RGB | CSS, design tools |
| CMYK | Cyan, magenta, yellow, and black ink coverage. The formula here is the naive conversion; real printing needs an ICC profile for the press, inks, and paper. | No, depends on inks and paper | |
| XYZ | CIE tristimulus values: the standard observer’s response, computed from a spectrum. Y is the luminance, 100 for the white. | Yes, for a stated illuminant and observer | The hub that every other space converts through |
| xyY | Chromaticity x = X/(X + Y + Z) and y = Y/(X + Y + Z), plus the luminance Y. | Yes, as for XYZ | Gamut diagrams, LED and display specs |
| CIELAB | L* lightness, a* red–green, b* yellow–blue, built so equal distances look roughly equally different. | Yes, for a stated illuminant, observer, and white | Color tolerances, coatings, plastics, paint, QC |
| LCh | CIELAB in polar form: lightness, chroma (distance from gray), and hue angle. | Yes, as for CIELAB | Describing shifts as lighter, more saturated, or hue-shifted |
sRGB values are gamma-encoded, so channel value 128 is only about 22 % of full light; the converter linearizes them before computing XYZ (exact formulas under How it is calculated). Many CIELAB colors, especially saturated cyans and greens, fall outside sRGB. They cannot be shown exactly on a typical screen or written as a hex code, which is why the converter flags out-of-gamut colors.
D65 or D50? CIELAB numbers depend on the white they are computed against. This page uses D65, the white of the sRGB standard and a common spectrophotometer setting. CSS lab() and lch() and ICC color management use a D50 white, reached from sRGB by a chromatic adaptation transform, so the same color gets different numbers: #3366CC is L* 45.03, a* 18.71, b* −57.85 here but lab(44.12% 10.95 -59.09) in CSS. Pasted into CSS lab(), this page’s values give a visibly different blue, rgb(83, 99, 205), ΔE00 = 5.0 away. The converter’s CSS lab() row gives the D50 form of whatever color is entered.
Hue in HSV is not hue in CIELAB
HSV and HSL are geometric rearrangements of RGB, not models of perception. A fully saturated yellow and a fully saturated blue both have V = 100 %, but yellow looks far lighter (L* 97 against 32). Equal steps in HSV hue are not equal perceived steps, and HSV hue angles do not match CIELAB hue angles. Use HSV for quick thresholds on images taken under fixed conditions; use CIELAB and ΔE when the numbers must match what people see or what another instrument reports.
Color difference: ΔE*ab and ΔE00
The simplest color difference is the straight-line distance in CIELAB, ΔE*ab. CIELAB is not perfectly uniform. A given ΔE*ab looks larger between near-neutral colors than between saturated ones, mostly in chroma and hue; lightness steps look smaller near black and white than at mid-gray; and in the blues, the ellipses that bound equally visible differences are tilted. CIEDE2000 (ΔE00) corrects for these effects with weighting functions for lightness, chroma, and hue, a hue-dependent factor, a rotation term for the blues, and a rescaling of a* near the gray axis. For the default colors, ΔE*ab is 4.68 but ΔE00 only 1.01: most of the difference is chroma in a saturated blue, where the eye is least sensitive, and the blue rotation term lowers it further.
How visible is a given ΔE00? In a study with 175 observers comparing pairs of ceramic samples in a viewing booth, half of the observers could see a difference of ΔE00 = 0.8 (ΔE*ab = 1.2), and half judged a difference of ΔE00 = 1.8 (ΔE*ab = 2.7) no longer acceptable as a match. The notes under the result use these thresholds. Visibility also depends on sample size, gloss, texture, and how close the samples sit, so production tolerances are agreed between buyer and seller against a master sample, often with separate limits on ΔL*, Δa*, and Δb* (or ΔL*, ΔC*, and ΔH*) when one direction matters more.
How instruments measure color
Spectrophotometers measure the reflectance or transmittance spectrum, usually every 10 nm over 400–700 nm or a wider range, and compute XYZ by weighting it with a standard illuminant and observer (the method of ASTM E308 and CIE 15). Because they measure the spectrum, the color under any standard illuminant and observer can be computed afterward, except for fluorescent samples, whose emission depends on the instrument’s own light source. Measurement geometry matters: d/8° integrating-sphere instruments can include (SCI) or exclude (SCE) the specular reflection, while 45°/0° instruments exclude it, much as a viewer looks past the glare. Always report the illuminant, the observer (2° or 10°), and the geometry with the numbers.
Instruments of the same model typically agree to within a few tenths of a ΔE*ab on standard ceramic tiles, but instruments of different makes often differ by 0.5–1 ΔE*ab or more on the same samples. Compare readings from one instrument where you can; when two must agree, measure shared reference samples on both and track the offset.
Handheld spectrophotometers are the lab and QC reference. They press against the sample with a fixed aperture and their own calibrated light source. Inline (non-contact) spectrophotometers measure on a moving line from a fixed standoff. They need a stable distance and tilt, a defined geometry, and regular checks against reference tiles. Their CIELAB agrees with a handheld instrument’s only as well as the two geometries and calibrations match, so check the offset on shared samples before comparing numbers.
Cameras report device RGB, not CIE values. A camera’s red, green, and blue sensitivities are not a linear transformation of the CIE color-matching functions, and auto exposure, auto white balance, gamma, and changes in lighting all move the numbers. As a result, HSV or RGB values from a camera often have no simple, let alone linear, relationship to CIELAB from a spectrophotometer, even when both track the same physical change. Cameras work well for relative color control: lock exposure, gain, and white balance, use a stable enclosed light source, read linear (raw) values, and compare each part to reference samples in the same image. For absolute color, characterize the camera against a color target to build a correction (a 3 × 3 matrix or a polynomial), and verify it against a spectrophotometer over the range of colors you produce: a correction fitted on one material often fails on another.
Measuring the color of low-e coated glass
A sputtered (soft-coat) low-e coating is a stack of thin silver and dielectric layers, and its color comes from thin-film interference; pyrolytic (hard-coat) low-e uses a fluorine-doped tin-oxide layer instead. A few nanometers of change in a dielectric layer moves a* and b* by a unit or more, so color is one of the most sensitive production checks of coating thickness and uniformity. Silver thickness also sets the sheet resistance and emissivity (see the sheet resistance tool), so measuring color and sheet resistance together checks both the dielectric and the silver layers.
- Measure three things: transmitted color, reflected color from the glass side (what you see from outside when the coating is on surface #2), and reflected color from the film side. They differ, and specifications usually name each one.
- Use specular geometry. Coated glass is mirror-like, so the reflected color lives in the specular component. Use a specular-included (SCI) sphere or a dedicated specular-reflectance geometry. A 45°/0° instrument largely misses it.
- Control what is behind the sample. A lite’s reflectance includes the reflection from its uncoated back surface, about 4 % for clear glass (Fresnel reflection); light that passes through and returns from whatever lies behind adds more. Back the sample with a light trap or black velvet, never a white tile, and state whether the measurement is on monolithic glass or the finished insulating unit, since the second lite and gap change reflected color.
- Watch the angle. The interference spectrum shifts to shorter wavelengths as the viewing angle increases, because the optical path through each layer shrinks, so reflected color changes with angle; the direction of the change depends on the coating design. Measure at the specified angle, usually near-normal, and check off-angle appearance separately if the façade will be seen obliquely.
- Substrate matters. The iron in clear glass tints transmission and glass-side reflection green (6 mm clear float glass transmits with a* near −2, low-iron glass near −0.5), so the same coating looks different on clear and low-iron glass and at different thicknesses.
- Map uniformity. Measure several points across the lite and report the spread as ΔE to the center or to a master. Edge and end effects in the coater show up here first.
- Cameras and handhelds together. A camera system under fixed lighting can flag streaks and gradients over the whole lite, while spot measurements with a spectrophotometer anchor the absolute values. Expect to correlate them empirically; the relationship is usually not linear and can differ between coatings.
The glazing performance calculator computes transmitted and reflected CIELAB for full glazing units, and the spectrum panel above converts any measured curve to color.
How it is calculated
sRGB to XYZ. Each 8-bit channel is divided by 255 and linearized with the sRGB transfer function of IEC 61966-2-1; the inverse brings linear values back:
The linear values go through the matrix built from the sRGB primaries, (x, y) = (0.64, 0.33), (0.30, 0.60), and (0.15, 0.06), with its columns scaled so that R = G = B = 1 gives the D65 white of the CIE 1931 2° observer computed from the CIE 1 nm tables, (Xn, Yn, Zn) = (95.047, 100, 108.883):
The code keeps this matrix and its inverse at full precision, so grays stay neutral through any round trip. IEC 61966-2-1 prints a 4-decimal matrix based on the rounded white chromaticity (0.3127, 0.3290), and CSS Color 4 uses that chromaticity exactly; the CIELAB values they give differ from this page’s by at most 0.02. Chromaticity is x = X/(X + Y + Z) and y = Y/(X + Y + Z).
CIELAB and LCh (CIE 15; ISO/CIE 11664-4) follow from XYZ and the white:
The hue angle hab runs from 0° to 360°. The inverse transform follows CIE 15 (Appendix D of the 2004 edition), with its break at L* = 8.
The CSS lab() row adapts XYZ from the D65 white to the D50 white (x = 0.3457, y = 0.3585) with the linear Bradford transform, as CSS Color 4 does, and then applies the same CIELAB formulas with the D50 white. For every 8-bit sRGB color the result is within 0.01 of the value from CSS Color 4’s own matrices.
HSV, HSL, and CMYK use the gamma-encoded sRGB values R, G, B from 0 to 1, with max and min the largest and smallest of the three. HSV (Smith): V = max and S = (max − min)/max. HSL (Joblove and Greenberg; CSS Color 4): L = (max + min)/2 and S = (max − min)/(1 − |2L − 1|). Both use the same hue angle, set by which channel is largest. CMYK: K = 1 − max, C = (1 − R − K)/(1 − K), and likewise M from G and Y from B.
Color differences are sample minus reference. The CIELAB differences (CIE 15) are
with Δhab wrapped into ±180°, so that \((\Delta E^*_{ab})^2 = (\Delta L^*)^2 + (\Delta C^*_{ab})^2 + (\Delta H^*_{ab})^2\). CIEDE2000 (CIE 15; ISO/CIE 11664-6) rescales a* near the gray axis and weights the differences, here with kL = kC = kH = 1:
Bars are means over the two colors; the mean hue and Δh′ account for the 360° wrap, following the implementation notes of Sharma, Wu, and Dalal, whose 34 published test pairs this code reproduces to their four decimals.
Spectrum to color (CIE 15; ASTM E308). The measured reflectance or transmittance R(λ) is interpolated to λi = 380, 385, …, 780 nm by third-order (Lagrange) interpolation through the four nearest data points, one of the methods CIE 15 lists, and held at its end values beyond the data. The weights WX,i, WY,i, WZ,i are D65 times the color-matching functions \(\bar x, \bar y, \bar z\), integrated over each 5 nm step from the CIE 1 nm tables and scaled so that \(\sum_i W_{Y,i} = 1\). Then
so a perfect white gives exactly L* = 100 and a* = b* = 0. For 1 and 5 nm data the interpolation changes nothing; for 10 and 20 nm data it matches ASTM E308’s tabulated weights to within about 0.03 ΔE00 on typical reflectance spectra, where straight-line interpolation can be off by more than 0.5.
Worked example
The default colors reproduce by hand. #3366CC is R, G, B = 51, 102, 204, or 0.2000, 0.4000, 0.8000 of full scale, which linearize to 0.033105, 0.132868, 0.603827. The matrix gives X, Y, Z = 17.012, 14.564, 59.030, so X/Xn, Y/Yn, Z/Zn = 0.178983, 0.145643, 0.542138, whose cube roots are 0.563556, 0.526134, 0.815399. Then L* = 116 × 0.526134 − 16 = 45.03, a* = 500 × (0.563556 − 0.526134) = 18.71, and b* = 200 × (0.526134 − 0.815399) = −57.85, with C*ab = 60.80 and hab = 287.9°. The same steps take the reference #3A66C4 to L*, a*, b* = 44.78, 16.69, −53.63.
The differences are ΔL* = +0.25, Δa* = +2.02, and Δb* = −4.22, so ΔE*ab = 4.68, of which ΔC*ab = +4.63 and ΔH*ab = +0.65. For CIEDE2000, both colors are strongly chromatic, so G = 0.0007 and a′ barely changes: ΔL′ = 0.250, ΔC′ = 4.633, ΔH′ = 0.652. At the means L′ = 44.91, C′ = 58.49, and h′ = 287.6°, the weights are SL = 1.057, SC = 3.632, and SH = 1.323 (T = 0.368), and the blue rotation term is RT = −1.449. The weighted differences 0.236, 1.276, and 0.493 combine as √(0.236² + 1.276² + 0.493² − 1.449 × 1.276 × 0.493) = 1.01; without RT the result would be 1.39.
In the spectrum panel, Load example gives L* 25.50, a* 20.60, b* −6.49 and Y = 4.58 % for the illustrative low-e reflectance curve, which is tabulated every 20 nm; an independent ASTM E308 calculation gives 25.50, 20.60, −6.50.
Assumptions and limits
- One viewing condition. Everything is for CIE illuminant D65 and the 1931 2° observer, with no 10° observer, no other illuminant, and no chromatic adaptation (the read-only CSS lab() row is the one exception). CIELAB from a D65/10° instrument setting, from CSS lab(), or from ICC (D50) software is therefore not interchangeable with these values, though two readings taken in the same setting can still be compared in the ΔE panel.
- sRGB only. HEX, RGB, HSV, HSL, and CMYK are sRGB codes; convert Display P3 or Adobe RGB values first. Colors outside sRGB are clipped channel by channel, not gamut-mapped, so their swatch and RGB-based codes are approximate, while XYZ, xyY, CIELAB, and LCh stay exact. HEX and RGB show the nearest 8-bit value.
- CMYK is the naive formula applied to gamma-encoded sRGB. It ignores inks, paper, dot gain, and black generation; use the printer’s ICC profile for print.
- No plausibility check on CIE entries. Any L*, a*, b*, XYZ, or xyY entry is accepted, including combinations outside the spectral locus that no real color can have.
- ΔE00 is for small differences between uniform samples under the CIE reference conditions: a D65 simulator at 1000 lx, a mid-gray surround, samples larger than 4° placed edge to edge, and differences up to about 5 CIELAB units. It is not a Euclidean distance in any color space, and it jumps slightly where the two hues differ by about 180°.
- Spectrum panel. For non-fluorescent samples only. The values must be reflectance factors or transmittances relative to a perfect white or to air, covering at least 400–700 nm, and they are used as given, with no bandpass correction. The interpolation assumes a smooth spectrum, which holds for reflectance and transmittance but not for line spectra, and the geometry (SCI, SCE, or specular) and sample backing are whatever the data were measured with.
References
Primary sources and standards
- CIE 015:2018, Colorimetry, 4th ed., CIE, Vienna (2018), doi:10.25039/TR.015.2018 (standard observers and illuminants, tristimulus values and chromaticity, CIELAB and LCh, ΔE*ab and ΔH*ab, CIEDE2000, measurement geometries).
- CIE 15:2004, Colorimetry, 3rd ed., CIE, Vienna (2004), superseded by ref. 1: §7.2 (interpolating spectral data, with third-order Lagrange interpolation among the methods listed, and extending them with end values “as a rough approximation”), §8.3 (CIEDE2000 and its reference conditions), and Appendix D (inverse CIELAB transform).
- ISO/CIE 11664-4:2019, Colorimetry — Part 4: CIE 1976 L*a*b* colour space; ISO/CIE 11664-6:2022, Colorimetry — Part 6: CIEDE2000 colour-difference formula (the standardized CIELAB and CIEDE2000 definitions).
- CIE datasets (2019): “CIE 1931 colour-matching functions, 2 degree observer,” doi:10.25039/CIE.DS.xvudnb9b; “CIE standard illuminant D65,” doi:10.25039/CIE.DS.hjfjmt59; “CIE 1931 chromaticity coordinates of spectrum loci, 2 degree observer,” doi:10.25039/CIE.DS.mifmy4x4 (the spectrum weights, the white Xn, Yn, Zn = 95.047, 100, 108.883, and the spectral locus of the diagram).
- IEC 61966-2-1:1999, Multimedia systems and equipment — Colour measurement and management — Part 2-1: Colour management — Default RGB colour space — sRGB (sRGB primaries, D65 white, and transfer function).
- W3C, CSS Color Module Level 4, Candidate Recommendation Draft (2026), w3.org/TR/css-color-4 (hex notation, HSL, the sRGB transfer function, the D50 white of CSS lab() and of ICC color management, and the Bradford adaptation from D65 to D50).
- A. R. Smith, “Color gamut transform pairs,” ACM SIGGRAPH Comput. Graph. 12, 12–19 (1978), doi:10.1145/965139.807361 (HSV).
- G. H. Joblove and D. Greenberg, “Color spaces for computer graphics,” ACM SIGGRAPH Comput. Graph. 12, 20–25 (1978), doi:10.1145/965139.807362 (HSL).
- M. R. Luo, G. Cui, and B. Rigg, “The development of the CIE 2000 colour-difference formula: CIEDE2000,” Color Res. Appl. 26, 340–350 (2001), doi:10.1002/col.1049 (what each CIEDE2000 term corrects).
- G. Sharma, W. Wu, and E. N. Dalal, “The CIEDE2000 color-difference formula: Implementation notes, supplementary test data, and mathematical observations,” Color Res. Appl. 30, 21–30 (2005), doi:10.1002/col.20070; test data at hajim.rochester.edu/ece/sites/gsharma/ciede2000 (the implementation followed here and the 34 test pairs it reproduces).
- R. D. Paravina, R. Ghinea, L. J. Herrera, et al., “Color difference thresholds in dentistry,” J. Esthet. Restor. Dent. 27, S1–S9 (2015), doi:10.1111/jerd.12149 (50:50 % perceptibility and acceptability thresholds, ΔE00 = 0.8 and 1.8, from 175 observers).
- ASTM E308-22, Standard Practice for Computing the Colors of Objects by Using the CIE System, doi:10.1520/E0308-22; ASTM E1164-23, Standard Practice for Obtaining Spectrometric Data for Object-Color Evaluation, doi:10.1520/E1164-23; ASTM D2244-25, Standard Practice for Calculation of Color Tolerances and Color Differences from Instrumentally Measured Color Coordinates, doi:10.1520/D2244-25 (computing color from spectra, the measurement parameters to report, and tolerances agreed between buyer and seller).
- J. Seymour, “Evaluation of reference materials for standardization of spectrophotometers,” TAGA Proceedings 2013, 355–379, PDF (surveys how closely spectrophotometers of the same and of different makes agree).
- G. Hong, M. R. Luo, and P. A. Rhodes, “A study of digital camera colorimetric characterization based on polynomial modeling,” Color Res. Appl. 26, 76–84 (2001), doi:10.1002/1520-6378(200102)26:1<76::AID-COL8>3.0.CO;2-3 (camera RGB is not colorimetric; characterization against a target, and why it depends on the material).
- R. S. Berns, Billmeyer and Saltzman’s Principles of Color Technology, 4th ed., Wiley (2019), doi:10.1002/9781119367314, chs. 4–6 and 10 (colorimetry, color difference and tolerances, measurement geometry and spectrophotometry, digital cameras).
- G. Ding and C. Clavero, “Silver-based low-emissivity coating technology for energy-saving window applications,” in Modern Technologies for Creating the Thin-film Systems and Coatings, InTech (2017), doi:10.5772/67085 (sputtered silver and pyrolytic tin-oxide low-e coatings).
- H. A. Macleod, Thin-Film Optical Filters, 5th ed., CRC Press (2017), doi:10.1201/b21960 (interference in multilayer coatings and its shift with angle).
- M. Rubin, “Optical properties of soda lime silica glasses,” Sol. Energy Mater. 12, 275–288 (1985), doi:10.1016/0165-1633(85)90052-8 (optical constants of clear and low-iron glass, from which the transmitted a* values above are computed).
Textbooks
- J. H. Moore, C. C. Davis, M. A. Coplan, and S. C. Greer, Building Scientific Apparatus, 4th ed., Cambridge University Press (2009), sec. 4.5.3, pp. 249–250 (photometry, Table 4.6: the V(λ) luminous efficiency function, the 683 lm/W peak, and the correspondence of radiometric and photometric quantities; an introduction only).
- C. Guo and S. C. Singh (eds.), Handbook of Laser Technology and Applications, vol. 1, 2nd ed., CRC Press (2021), sec. 12.3.2, p. 210 (vertical incidence and the effect of a single thin layer: the 4 % reflection per glass surface and interference in a single quarter-wave layer).
Free introductions
- Konica Minolta, “Precise Color Communication,” illustrated booklet, konicaminolta.com (color spaces, ΔE and CIEDE2000, illuminants and observers, SCI and SCE geometry, and fluorescent samples).
- MDN Web Docs, “<color> CSS type,” developer.mozilla.org (how hex, rgb(), hsl(), lab(), and lch() colors are written on the web).
- CIE, “e-ILV,” the free online International Lighting Vocabulary (CIE S 017:2020), cie.co.at/e-ilv (the official definition of each colorimetric term on this page).