Convert CIELAB values to hex. Accepts lab() CSS syntax or bare L, a, b numbers, runs the exact reverse pipeline back to sRGB, and warns when a Lab color sits outside the sRGB gamut — in that case the swatch shows the clamped color and the Gamut Mapper gives a hue-preserving fit.
Generated locally in your browser — your colors, settings and code never leave this page.
The direction that needs a gamut conscience
Lab’s volume dwarfs sRGB’s: it happily addresses colors no monitor emits. Converting Lab to hex therefore has two outcomes — a faithful in-gamut result, or an out-of-gamut request that must be either flagged (this tool) or silently mangled (many tools). The difference matters anywhere Lab values come from instruments or print work, which is precisely where accuracy matters most.
Worked example: lab(65% 45 −30)
A vivid periwinkle-ish request:
Lab → XYZ (D50) (invert cube-root response) XYZ D50 → D65 (Bradford, reversed) XYZ → linear sRGB (matrix) linear → sRGB (gamma encode) → in gamut → about #978fe0
Shift that request to lab(65% 85 −60) and the blue channel computes past 255: no such sRGB color. The tool then shows the clamped swatch, labels it, and points to the Gamut Mapper — whose chroma-reduction answer keeps the hue and lightness you asked for.
Reading a*/b* requests like a forecast
Rough sRGB weather map: |a*| and |b*| below ~60 with mid L* almost always fit; past ~90, or high chroma at very high/low L*, expect trouble. The instant feedback here builds that intuition faster than any chart.
Round-trip guarantee
For in-gamut colors the reverse pipeline reproduces the source exactly (tested across the RGB grid). Out-of-gamut inputs are the documented exception — they have no faithful hex, and the tool’s honesty about that is the feature.
Reference values, computed live
Anchor values make coordinate systems navigable. Seven colors specified exactly as lab() input, with the hex each yields through the reverse pipeline:
| Color | LAB | HEX |
|---|---|---|
| orchid | lab(62.8% 52.5 -34.1) | #da70d6 |
| tomato | lab(63% 59.4 47.9) | #ff6347 |
| mediumseagreen | lab(65.2% -46 23.7) | #3cb371 |
| mediumpurple | lab(54.5% 31.7 -50.6) | #9370db |
| goldenrod | lab(71.3% 12.2 68.7) | #daa520 |
| crimson | lab(47.9% 71.3 35.5) | #dc143c |
| olivedrab | lab(54.8% -24.6 49) | #6b8e23 |
Every row is displayable, so every conversion is exact — and each also doubles as a converter test you can replay anywhere: any tool given these lab() values should return these hex codes. Tools that disagree by more than a digit in the last place are skipping chromatic adaptation, the most common shortcut in casual implementations.
How to use the LAB to HEX Converter
- Enter the Lab color – lab(52.5% 42.2 -47.4) or bare L, a, b numbers.
- The result updates live as you type – no convert button needed.
- Watch for the gamut warning: Lab is bigger than sRGB.
- Copy the value with the copy button, or switch the output format dropdown for other export shapes.
Frequently asked questions
How does a Lab value become a hex code?
The forward pipeline in reverse: Lab functions inverted to XYZ (D50), Bradford-adapted to D65, matrixed to linear sRGB, gamma-encoded, scaled to 0-255. The implementation round-trips against CSS reference values in automated tests.
Why does my Lab color trigger an out-of-gamut warning?
Lab can describe colors no screen shows – lab(50% 90 -90) is a legal triplet with no sRGB representation. The tool shows the clamped preview and recommends the Color Gamut Mapper, which reduces chroma while preserving hue instead of distorting all three channels.
What hex is lab(100% 0 0)?
#ffffff exactly – full lightness with zero chromatic components is the white point. Similarly lab(0% 0 0) is #000000. These identities are useful sanity checks for any Lab implementation.
Can I paste lab() straight from CSS?
Yes – the CSS syntax with the % on L parses directly, as do bare numbers. Percentages on a and b (scaled to ±125 per the spec) work too.
Why do results differ from an online converter I used before?
Almost always the D50/D65 handling: converters that skip chromatic adaptation produce Lab values a few units off, which matters at ΔE tolerances. This one follows the CSS Color 4 reference chain; its red anchor lab(54.29% 80.8 69.89) matches the spec example.
Do negative a* or b* mean an invalid color?
Not at all – negative is just the green or blue direction. lab(87% -79 81) is a strong green. Only magnitudes far outside ±128-ish start leaving displayable territory.
When would I write lab() in CSS directly?
When you want a color specified by appearance that survives future wider-gamut screens: lab() is display-independent, and browsers map it to whatever the device can show. Pair it with a hex fallback for very old engines.