How to convert RGB to Hexadecimal

The RGB color model is probably the most familiar color model in the world. IT is an additive color model that uses Red, Green, and Blue primary colors of light mixed together in numerous ways to produce a broad array of other colors. For computers, these color values are stored as unsigned integer numbers ranging from 0 to 255 which is exactly the range that a single 8-bit byte can offer.

On the other hand, hexadecimal system is probably more familiar as a numeral system that is commonly used in computers and other digital systems. It is base 16 and it has 16 symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 and A, B, C, D, E, F.

Table #1: Decimal to hexadecimal conversion table

Decimal0123456789101112131415
Hexadecimal0123456789ABCDEF

Instructions:

  1. Start with any RGB value
  2. Find a corresponding HEX value for each individual RGB color
  3. Form a resulting hexadecimal number by concatenating individual HEX color values: RRGGBB

If you don't know hot to convert these values, which are essentially Integers (scope well within Decimal numbering system) feel free to consult our How to convert Decimal to Hexadecimal tutorial.

Example #1: Convert RED COLOR (255, 0, 0) into hexadecimal

Step descriptionResult
Convert 255 (RED) into 2-digit hexadecimal color codeFF
Convert 0 (GREEN) into 2-digit hexadecimal color code00
Convert 0 (BLUE) into 2-digit hexadecimal color code00
Resulting hexadecimal number#FF0000

Example #2: Convert BROWN COLOR (165,42, 42) into hexadecimal

Step descriptionResult
Convert 165 (RED) into 2-digit hexadecimal color codeA5
Convert 42 (GREEN) into 2-digit hexadecimal color code2A
Convert 42 (BLUE) into 2-digit hexadecimal color code2A
Resulting hexadecimal number#A52A2A

Convert an RGB color to a hexadecimal color.


Have feedback or questions?

Please, do let us know and we'll see what we can do for you.

0/2000