In a html web page, there is code such as <body bgcolor=#ffffff> or color=”#000000″. The “ffffff” is the color RGB hexadecimal value which will translate into a white, and “000000” is black.

The RGB color code must be converted into hexadecimal (Base-16) number in order for the browsers to understand them. Then the resulting two-digit hexadecimal (“hex” for short) numbers are strung together into a single six-digit code. So in the example above, the first two “f”s and “0”s stand for the red value, the next two stand for green, and the last two for blue.

It’s possible to get the RGB hex value from a color chart. But if you encounter a favorite color, it’s possible to get its RGB value and convert it into hex code.

To get the RGB value of a color from a photo, simply open the photo or picture in Microsoft Paint or any image processing software. Use the pick color tools to pick the color and the RGB value should be shown. For Microsoft Paint, after you pick the color, click on Colors menu, and then Edit Colors. On the window shown, click on Define Custom Colors, and you will see the RGB value of the color you just selected shown there.

For translation/conversion to Hex calculation, we will use the color of lovely sea green with the RGB values R=51, G=219, B=153 as example.

To translate the RGB value into hexadecimal value, first take the value of Red (51) and divide it by 16. The balance is 3.1875. The integer, 3, will be the first number in the hexadecimal formula. The remainder (0.1875) should be multiplied by 16, which also results in the number 3. So, 51 translates to 33 in hex.

If you get integers and remainders that translate into from 10 or 15, then translate the two-digit number into a single letter (that’s where all the d’s and f’s come in), where 10=A, 11=B, 12=C, 13=D, 14=E, and 15=F. This becomes relevant to our lovely sea green when we calculate the hexadecimal equivalent of its Green value, which is 219. When we divide it by 16, we get 13.69. We translate 13 to D, and then multiply the remainder – 0.69 – by 16, and get 11, which equals B.

Repeat this formula for the Blue value, and then string them together (you should get 33DB99). 33DB99 is the RGB Hexadecimal value for the color which can be used in the html web page.