How to use it
- Type a colour such as
#ff5733,rgb(255 87 51)oroklch(0.68 0.21 34), or pick one with the colour button. - Read it in every format; each line has a Copy button.
- Tick “Commas” for the older
rgba(255, 87, 51, 0.5)style, or “Capital letters” for#FF5733.
Rules and limits
How colours are read and written
- Input: one colour in CSS Color 4 syntax: hex with 3, 4, 6 or 8 digits (
#optional),rgb()andrgba(),hsl()andhsla()with commas or spaces and the hue in deg, grad, rad or turn,hwb()with percentages,oklab(),oklch(), the 148 CSS colour names andtransparent; alpha after/(or as the fourth value with commas). Not read:none,lab(),lch(),color(), relative colours andcurrentcolor. - Output: HEX and
rgb()in 8 bits per channel,hsl()andhwb()with 2 decimals,oklab()andoklch()with 5 (the hue with 2), alpha with 3 decimals (2 hex digits in HEX); every output reads back to the same 8-bit colour and alpha. - OKLab from linear sRGB with Björn Ottosson’s matrices, as the contrast checker computes it; percentages as CSS Color 4 sets them (L: 100% = 1; a, b and C: 100% = 0.4); L is limited to 0 to 1 and a negative C to 0.
- Outside sRGB: an
oklab()oroklch()colour can be more saturated than sRGB can show. HEX,rgb(),hsl()andhwb()then show it clipped channel by channel (red, green and blue each limited to 0 to 255), not by the gamut mapping of CSS Color 4, which keeps the hue and lowers the chroma; the page says so, andoklab()andoklch()keep the typed values.
Tested limits
- Checked against Python 3.14: for 20,000 random 8-bit colours, HSL and HWB differ from
colorsysby at most 1.2e-13, OKLab and OKLCH from the CSS Color 4 sample code (through CIE XYZ, written in Python from the specification of 23 November 2026) by at most 3.8e-8, the hue by at most 0.002° where the chroma is over 0.001. 10,000 randomhsl()andhwb()texts givecolorsys’ sRGB within 1.7e-15. - Of 10,000 random
oklab()andoklch()colours, 8,230 lie outside sRGB; all give the specification’s sRGB within 6.5e-7, the same inside-or-outside verdict and the same clipped 8-bit channels. 240,000 outputs of 20,000 random colours with alpha, in both syntaxes, read back to the same 8-bit colour and alpha. In headless Chrome 157 a canvas drew 2,000 randomoklch(),oklab(),hsl()andhwb()colours: of the 1,177 inside sRGB, 1,170 have the page’s HEX and 7 differ by one step in a channel; of the 823 outside, 813 equal the page’s clipped value.
Questions and answers
Why use OKLCH instead of HSL?
HSL lightness is not what the eye sees: yellow and blue at 50% look very different. OKLCH is built to follow perceived lightness, so changing only the chroma or the hue keeps the colour about as light, which helps with palettes and contrast.
Why does my OKLCH colour come back as a different HEX?
Many OKLCH colours are brighter or more saturated than an sRGB screen can show. The page then limits each red, green and blue value to the screen’s range and says so; a browser may map such a colour differently, so pick a lower chroma if the exact look matters.
Will the HEX value give back exactly my HSL numbers?
Not always. HEX keeps 8 bits per channel, so an HSL value with decimals is rounded to the nearest of 16.7 million colours, and reading the HEX gives the HSL of that colour.
Is anything sent anywhere?
No. The conversion runs in your browser and the page sends nothing. The typed colour is kept only in this tab, like other tools’ options.