Color Converter
Edit any format and the others update. Accepts 3, 4, 6 and 8 digit hex, rgb(), hsl(), hwb(), cmyk() and CSS color names.
Type or paste into any field. Every field accepts every notation, including color names such as dodgerblue.
How to use the color converter
Type or paste a color into any field, or choose one with the color picker. The other fields update at once and each has a copy button. Every field understands every notation, so you can paste rgb(30 144 255) into the HEX field or the name tomato into the HSL field.
Supported formats
- HEX: 3, 4, 6 or 8 digits, with or without
#. The 4 and 8 digit forms carry an alpha channel. - RGB:
rgb(30, 144, 255)orrgb(30 144 255 / 50%), with numbers or percentages. - HSL:
hsl(210, 100%, 56%), with the hue in degrees, turns, radians or gradians. - HWB:
hwb(210 12% 0%), hue plus the amount of white and black. - CMYK:
cmyk(88%, 44%, 0%, 0%). - Names: the 148 CSS color names, plus
transparent. When a color matches a name exactly, the name is shown.
How the conversions work
Red, green and blue are scaled to 0 to 1. With max and min the largest and smallest channel and d = max − min, lightness is L = (max + min) / 2, saturation is S = d / (1 − |2L − 1|), and the hue is 60° times the position of the dominant channel between the other two. HWB uses whiteness = min and blackness = 1 − max. CMYK uses K = 1 − max and C = (1 − R − K) / (1 − K), with M and Y computed the same way. These are the algorithms given in the CSS Color Module Level 4.
Example
dodgerblue is #1e90ff, which is rgb(30, 144, 255). Lightness is (30/255 + 1) / 2 = 0.559, or 56%. Saturation is 100%, and the hue is 60 × ((30 − 144) / 225 + 4) = 209.6, shown as 210°. The result is hsl(210, 100%, 56%).
Limits
All colors are treated as sRGB, the default color space of CSS. Out-of-range values are clamped, as browsers do. Percentages in the output are rounded to whole numbers, so converting a rounded HSL value back may land one step away from the original hex code.
Frequently asked questions
How do I convert HEX to RGB?
Type the hex code in the HEX field, with or without the leading
Why does HSL give 56% lightness when I expected a round number?
Lightness is computed from the exact red, green and blue values, so it is rarely a whole number. The fields show the nearest whole percentage, and converting that rounded value back can differ from the original by one step in a channel.
Is the CMYK result suitable for print?
No. It is the simple mathematical conversion from screen RGB. Printers use ICC profiles for the ink and paper in use, so printed colors can look different.
Sources and methodology
Last reviewed 2026-12-04