Hex to Decimal Converter
Disclaimer: Whilst every effort has been made in building this calculator, we are not to be held liable for any damages or monetary losses arising out of or in connection with the use of it. This tool is here purely as a service to you, please use it at your own risk. Full disclaimer. Do not use calculations for anything where loss of life, money, property, etc could result from inaccurate calculations.
Decimal and Hex(adecimal)
Decimals are numbers as we use them in our daily lives; whole numbers, like those used for counting items. Decimal is called base 10, because it uses 10 distinct numbers to count.
i.e. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
Hex numbers, or "hexadecimal", to use its full name, is base 16. It uses 16 distinct characters to count.
i.e. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, plus the letters A, B, C, D, E, F.
Putting these numbers side by side, we can get an idea of how to convert the most basic of decimal numbers to hex:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1 2 3 4 5 6 7 8 9 A B C D E F
Seeing decimal and hex numbers together like this, we can easily see that 10 in decimal is the same as A in hex, and 15 in decimal is F in hex.
Hex in HTML
Hex numbers have been used in groups of six digits to represent colours on the World Wide Web. This is because a six-digit hex number represents the three colours red, blue and green (RGB), as three groups of two digits.
Taking as an example the colour purple, it's represented as FF00FF.
If we split this down, we can see the three groups:
FF 00 FF |Red|Green|Blue|
This represents purple because FF is the highest two-digit hex number possible, while 00 is the lowest. Red and blue mixed together form the colour purple.
Note: If a valid six-digit (or three-digit) hex number is entered in the form above, the corresponding set of decimal RGB values will also be given, in addition to the overall decimal result.
How to convert from hex to decimal
- Take a hex number and, starting from the right of it, take each character one at a time.
- Look up the corresponding decimal in the hex-decimal comparison list above (e.g. A = 10, F = 15).
- Multiply that corresponding decimal by an increasing multiple (power) of 16 (e.g. 160, 161, 162 etc).
- Add up the results.
Example of hex to decimal conversion
Let's take the hex number A3C2. It is made up of A, 3, C, 2. So we start on the right, with 2, and work backwards.
- 2 x (160) = 2 x 1 = 2
- C x (161) = 12 x 16 = 192
- 3 x (162) = 3 x (16 x 16) = 3 x 256 = 768
- A x (163) = 10 x (16 x 16 x 16) = 10 x 4096 = 40960
Add the results together:
- 2 + 192 + 768 + 40960 = 41922
So the decimal equivalent of A3C2 is 41922.
If you have any problems using this hex to decimal calculator, please contact me.