Convert a CIE L*a*b* color back into a displayable sRGB value, with the matching hex code and a live swatch. This reverses the RGB-to-Lab pipeline, so you can take perceptually-defined colors and turn them into something a screen can show.
Why convert Lab to RGB?
CIELAB is the color space designers and color scientists use when they need perceptual uniformity — equal numeric distances look equal to human eyes. It is used in color palette generation, image difference metrics (Delta-E), accessibility contrast tools, and CSS lab(). But monitors speak sRGB. This converter bridges that gap: you define a color perceptually in Lab, then get the closest sRGB representation your screen can actually show.
How it works
The conversion runs the RGB-to-Lab steps in reverse:
- Lab to XYZ — recover the intermediate
fvalues, then invert the nonlinearity (cube where above the threshold, linear segment below) and multiply by the D65 white:
fy = (L* + 16) / 116
fx = fy + a*/500
fz = fy - b*/200
X = Xn * finv(fx) Y = Yn * finv(fy) Z = Zn * finv(fz)
- XYZ to linear sRGB with the inverse matrix:
r = 3.2406*X - 1.5372*Y - 0.4986*Z
g = -0.9689*X + 1.8758*Y + 0.0415*Z
b = 0.0557*X - 0.2040*Y + 1.0570*Z
- Gamma encode each linear channel and scale to 0–255:
c <= 0.0031308 ? 12.92*c : 1.055*c^(1/2.4) - 0.055
If any channel lands outside 0–255 the color is out of sRGB gamut; it is clamped and flagged.
What the axes mean
- L* (0–100) — perceptual lightness. 0 is absolute black, 100 is the reference white. Doubling L* roughly doubles perceived brightness, unlike RGB where doubling a value does not.
- a* — green (negative) to red (positive). Neutral grays sit near zero.
- b* — blue (negative) to yellow (positive). Neutral grays also sit near zero.
Colors that are neutral (grey, white, black) always have a* and b* close to zero. Vivid, saturated colors push a* and b* to larger absolute values, and those high-chroma Lab colors are the ones most likely to fall outside the sRGB gamut.
Example
lab(55.6% 17.6 -64.4) converts back to approximately rgb(59, 130, 246) → #3B82F6.
For comparison, lab(0 0 0) → #000000 black, and lab(100 0 0) → #FFFFFF white. The conversion is most accurate in the middle of the sRGB gamut where clamping is not needed.
Out-of-gamut colors
The D65 white point is assumed, matching sRGB and CSS lab(). When Lab describes a color that no sRGB monitor can reproduce — typically highly saturated cyan-greens and some vivid blues — the RGB channels go outside 0–255. The converter clamps them to the nearest in-gamut value and flags the result so you know the displayed swatch is an approximation. If you need to show the exact color, consider a wide-gamut display mode (P3 or Rec. 2020) and CSS color() or oklch() instead of sRGB hex. All math runs in your browser — nothing is uploaded.