Hexadecimal is a base-16 numbering system. In English that means HEX numbers range from 0 to 15 whereas the decimal system is base-10 or 0 through 9. Because a hex digit can only use one space, after the number 9 the system uses the letters A through F to represent 10 to 15. All Windows based graphics use 256 shades of red, green and blue to create colors and there are a number of graphics programs that will give you the RGB values in decimal (0 to 255). To convert the decimal numbers to hex for use in web pages requires a little math. Windows users can also use the scientific calculator to do the conversion.
To convert a decimal number to hex you take the decimal number, divide by 16 to arrive at the first hex digit. The remainder is the second hex digit. So the decimal 255 divided by 16 is 15, or F. The remainder is 15 or another F, so the hex equivalent of 255 is FF.
Lets try another one, the decimal number is 195:
195 divided by 16 gives us 12 with a remainder of 3.
In Hex we know that 12 is C so our decimal 195 equals C3 in Hex.
One more just in case:
Our Decimal number is 14.
14 divided by 16 is 0
The remainder is 14, so our HEX number would be 0E. Notice that although our first digit is 0, we still use it.
By using some simple math we can then convert any color that we want for use on our web pages. If your graphics program says the color you want for your backgournd is 155 Red, 230 Blue and 100 Green, you can easily convert that so your background will be "#9BE664" (9B Red, E6 Blue, 64 Green).
To convert a hex number into decimal, you mulitply the first digit by 16 and then add the second digit. So 9A in hex would be 154 in decimal (9 x 16 = 144 + 10 = 154).