User Rating 0.0 ★★★★★
Total Usage 0 times
L*—
a*—
b*—
Is this tool helpful?

Your feedback helps us improve.

★ ★ ★ ★ ★

About

RGB triplets encode color as additive light intensities. They map poorly to human perception. Two colors separated by identical Euclidean distance in RGB space can appear drastically different to the eye, or nearly identical despite large numeric gaps. The CIE L*a*b* color space, standardized in 1976, was engineered to be perceptually uniform. A unit change in any axis corresponds to roughly the same perceived shift regardless of position in the gamut. This tool performs the full conversion pipeline: sRGB → linear RGB (inverse gamma, Îł2.2) → CIE XYZ (D65 illuminant matrix) → L*a*b*. The reverse path is also implemented. Floating-point rounding means round-trip results may differ by ±1 in the least significant RGB digit.

Comparing colors by their RGB distance is unreliable for quality control, accessibility contrast checks, or palette design. The ΔE metric (CIE76) computes Euclidean distance in L*a*b* space, producing a single number that correlates with what a trained observer actually sees. Values below 1.0 are imperceptible to most humans. Values above 5.0 indicate clearly distinct colors. This converter assumes standard sRGB with D65 reference white (Xn = 95.047, Yn = 100.0, Zn = 108.883). Results outside the sRGB gamut are clamped to [0, 255].

rgb to lab lab to rgb color converter delta e cie lab color distance perceptual color color space conversion srgb

Formulas

The conversion from sRGB to CIE L*a*b* proceeds in two stages. First, each sRGB channel is normalized to [0, 1] and linearized by removing the gamma companding.

c = CsRGB255
{
clin = c12.92 if c ≀ 0.04045clin = (c + 0.0551.055)2.4 otherwise

The linearized channels are then multiplied by the sRGB-to-XYZ matrix (D65 illuminant) and scaled by 100.

XY=Z 100 ⋅ 0.41245640.35757610.18043750.21267290.71515220.07217500.01933390.11919200.9503041 RlinGlinBlin

The XYZ values are converted to L*a*b* using the CIE 1976 formulas. Define the helper function f with threshold Δ = 0.008856 and Îș = 903.3.

{
f(t) = t13 if t > Δf(t) = Îș ⋅ t + 16116 otherwise
L* = 116 ⋅ f(YYn) − 16
a* = 500 ⋅ (f(XXn) − f(YYn))
b* = 200 ⋅ (f(YYn) − f(ZZn))

The perceptual color distance ΔE (CIE76) between two colors in L*a*b* space is the Euclidean distance.

ΔE = √(L1* − L2*)2 + (a1* − a2*)2 + (b1* − b2*)2

Where L* = lightness (0 black, 100 white), a* = green-red axis, b* = blue-yellow axis, Xn, Yn, Zn = D65 reference white tristimulus values, Δ = 0.008856 (threshold), Îș = 903.3 (CIE constant), and CsRGB = integer channel value in [0, 255].

Reference Data

ΔE RangePerceptual MeaningTypical Use Case
0 - 1.0Imperceptible differenceInstrument-grade color matching
1.0 - 2.0Perceptible through close observationPrint proofing, textile QC
2.0 - 3.5Perceptible at a glancePackaging color consistency
3.5 - 5.0Clearly different but same hue familyGeneral industrial tolerance
5.0 - 10.0Different color impressionInterior design palettes
10.0 - 49.0Colors appear unrelatedContrast accessibility (WCAG)
> 49.0Opposite ends of gamutMaximum visibility signage
CIE L*a*b* Channel Ranges
L*0 (black) to 100 (white)Lightness / luminance axis
a*−128 to +127Green (−) to Red (+) axis
b*−128 to +127Blue (−) to Yellow (+) axis
D65 Reference White (XYZ)
Xn95.047Standard daylight illuminant
Yn100.000Perfect reflecting diffuser
Zn108.883Blue-weighted component
sRGB → XYZ Matrix (D65)
Row 10.4124564, 0.3575761, 0.1804375X
Row 20.2126729, 0.7151522, 0.0721750Y
Row 30.0193339, 0.1191920, 0.9503041Z
Common Named Colors in L*a*b*
Pure Red (255,0,0)L*=53.23, a*=80.11, b*=67.22High chroma, mid lightness
Pure Green (0,128,0)L*=46.23, a*=−51.70, b*=49.90Moderate chroma
Pure Blue (0,0,255)L*=32.30, a*=79.20, b*=−107.86Low lightness, extreme b*
White (255,255,255)L*=100, a*=0, b*=0Achromatic, max lightness
Black (0,0,0)L*=0, a*=0, b*=0Achromatic, min lightness
Mid Gray (128,128,128)L*≈53.59, a*≈0, b*≈0Achromatic, perceptual midpoint

Frequently Asked Questions

The sRGB color space was designed for display hardware, not human vision. Its axes correspond to phosphor intensities, not perceptual attributes. The green channel contributes roughly 71.5% of luminance while blue contributes only 7.2%, so equal numeric shifts in R, G, and B produce vastly different perceived changes. CIE L*a*b* remaps these axes so that a unit Euclidean step in any direction corresponds to approximately the same visual shift, making ΔE a reliable single-number perceptual metric.
For most observers under controlled lighting, ΔE values below 1.0 are imperceptible. Industrial print standards (ISO 12647-2) typically allow ΔE ≀ 5.0 for process colors and ΔE ≀ 3.0 for spot colors. Brand color guidelines (Pantone matching) often require ΔE < 2.0. Note that CIE76 ΔE is not perfectly uniform - CIE94 and CIEDE2000 improve accuracy in saturated regions - but CIE76 remains the most widely used baseline.
Yes. The L*a*b* space encompasses all perceivable colors, which is a much larger volume than sRGB. When converting arbitrary L*a*b* values back to RGB, the resulting channel values may exceed 255 or drop below 0. This tool clamps such values to the valid [0, 255] range. If clamping occurs, the output swatch will not perfectly represent the original L*a*b* color - it shows the nearest in-gamut approximation.
The conversion pipeline involves floating-point exponentiation (gamma of 2.4), matrix multiplication with irrational coefficients, and cube roots. Each operation accumulates rounding error. When the final RGB values are rounded to integers, this error can shift a channel by ±1. For example, R=128 might become L*=53.585, a*=0.003, b*=-0.006, which converts back to R=128.0004 - still 128 after rounding. But values near .5 boundaries (e.g., 127.4999) may round differently.
D65 represents average midday daylight in Western/Northern Europe with a correlated color temperature of approximately 6504 K. It defines the "white point" - the XYZ values that correspond to a perfectly neutral white surface. All sRGB displays are calibrated to D65. Using a different illuminant (D50 for print, Illuminant A for incandescent) would shift every LAB value. This tool uses D65 exclusively: Xn=95.047, Yn=100.000, Zn=108.883.
The sRGB transfer function is not a pure gamma of 2.2. It is a piecewise function: a linear segment for very dark values (c ≀ 0.04045, divided by 12.92) joined to a power curve ((c+0.055)/1.055)^2.4 for brighter values. The linear tail prevents numerical instability near black and provides a better fit to CRT response curves. Using a simple 2.2 power law introduces errors up to ΔE ≈ 1.3 in shadow tones, which is perceptible.