Hex to RGB Converter

Type or paste a hex color code. You get the RGB values, a preview of the color, and the HSL and CMYK forms.

How it works

Screens make every color by mixing red, green and blue light. Each of the three is set to a level from 0, which is off, to 255, which is full strength. That gives 256 × 256 × 256, or about 16.7 million, possible colors.

RGB writes the three levels as ordinary numbers: rgb(91, 61, 245). Hex writes the same three levels in base 16, two digits each, after a hash sign: #5B3DF5. The two forms describe exactly the same color.

To convert hex to RGB, split the six digits into three pairs and turn each pair from base 16 into a normal number. The first digit of a pair counts sixteens and the second counts ones. The letters A to F stand for 10 to 15.

  • 5B is 5 × 16 + 11 = 91
  • 3D is 3 × 16 + 13 = 61
  • F5 is 15 × 16 + 5 = 245

Short codes. A three digit code such as #F80 is shorthand. Each digit is doubled, so it means #FF8800.

Eight digit codes. Some tools add a fourth pair for opacity, where FF is solid and 00 is invisible. This converter reads the standard three and six digit forms.

HSL and CMYK. HSL describes the same color as a hue angle, a saturation and a lightness, which is easier to adjust by eye. CMYK is the ink model used in printing. The CMYK figures here come from the simple formula and are a starting point only, since real print color depends on the press and the paper.

Worked example

#FFC83D: FF is 255, C8 is 12 × 16 + 8 = 200, and 3D is 61. So the color is rgb(255, 200, 61), a warm yellow.

Common questions

How do I convert hex to RGB by hand?

Split the code into three pairs. For each pair, multiply the first digit by 16 and add the second, counting A to F as 10 to 15.

What is #FFFFFF in RGB?

rgb(255, 255, 255), which is white. #000000 is rgb(0, 0, 0), which is black.

Does it matter if hex letters are capital or small?

No. #ffc83d and #FFC83D are the same color.

Related tools