How this calculator works
RGB, hex, HSL, HWB and CMYK are five descriptions of the same colour. RGB and hex store the red, green and blue channels directly, with hex writing each 8-bit channel as two hexadecimal digits. HSL rearranges the same cube into a hue angle, a saturation and a lightness. HWB uses the same hue with a whiteness and a blackness, which makes tinting and shading easy to picture. CMYK is a subtractive model used in printing, computed here from the RGB channels with a simple conversion. Every readout starts from the same rounded 8-bit RGB colour, so the five forms describe one screen colour rather than five slightly different ones.
Formula
HSL: max and min are the largest and smallest of R, G and B divided by 255; lightness = (max + min) / 2, saturation = (max - min) / (1 - |2L - 1|), and hue comes from which channel is largest. HWB: whiteness = min(R,G,B) / 255, blackness = 1 - max(R,G,B) / 255, with the same hue. CMYK: K = 1 - max(R,G,B), C = (1 - R - K) / (1 - K), and likewise for M and Y. All percentages are multiplied by 100.
Worked example
The orange FFA500 is rgb(255, 165, 0). Its HSL is hsl(38.8, 100%, 50%) and its HWB is hwb(38.8, 0%, 0%). Its CMYK from this conversion is cmyk(0%, 35.3%, 100%, 0%). Pure red FF0000 is hsl(0, 100%, 50%) and hwb(0, 0%, 0%).
Advertisement
Frequently asked questions
Why do the HSL and HWB hue values differ slightly from the input?
The page rounds the colour to whole 8-bit RGB channels before deriving the other forms. A hue entered with a fraction can land between two representable colours, so the readout shows the hue of the nearest 8-bit colour.
Is the CMYK value suitable for printing?
No. It is a simple mathematical conversion from sRGB. Professional printing uses ICC profiles, ink limits and a specific press condition, and a converter cannot predict the printed result without those.
What happens when whiteness plus blackness exceeds 100 per cent?
CSS normalises the pair to a grey whose lightness is the whiteness share of their sum. This page follows that rule and the RGB output shows the resulting grey.
Does a hex code include transparency?
Not here. This page reads three or six hex digits, so the colour is fully opaque. Eight-digit hex codes add an alpha pair that would need a separate opacity value.