The Numeric Systems: Conversion from Hexadecimal to Decimal

 

Converting a Byte From Hexadecimal to Decimal

A byte is made of 8 bits. This means that the highest hexadecimal value you can represent with a byte is 0xFF and the highest decimal value is 255. To convert a hexadecimal number to decimal, multiply each hexadecimal digit to its 16 base value. Starting on the left side, which is the low order bit, use the following table:

161 160
   

Consider a hexadecimal byte represented with 0x24, to convert it to decimal, you would use:

    2 * 161 + 4 * 160 

= (2 * 16) + (4 * 1)

= 32 + 4

= 36

Therefore, the decimal equivalent of 0x24 is 36

Consider another hexadecimal number as 0x5D. To convert it to decimal, you would write:

5 * 161 + D * 160. If you look at the table of numeric conversions,

Decimal Hexadecimal Binary
0 0 0000
1 1 0001
2 2 0010
3 3 0011
4 4 0100
5 5 0101
6 6 0110
7 7 0111
8 8 1000
9 9 1001
10 A 1010
11 B 1011
12 C 1100
13 D 1101
14 E 1110
15 F 1111

Table of numeric conversions

you would see that the decimal value of hexadecimal D is 13. Therefore, the conversion would be performed as follows:

    5 * 161 +   D * 160 

=  5 * 161 +  13 * 160 

= (5 * 16) + (13 * 1)

= 80 + 13

= 93

Therefore, hexadecimal 0x5D = decimal 93

 

Practical Learning Practical Learning: Converting a Byte From Hexadecimal to Decimal

 

  1. Click the Hex radio button and click the buttons to display 24
  2. Click the Dec radio button to see the result
  3. Click the Hex radio button
  4. Press the numeric keys on the keyboard to display 5D
  5. Click the Dec radio button to see the result

Converting any Number From Hexadecimal to Decimal

To convert a hexadecimal number to decimal, multiply each digit of the hexadecimal number to its 16-base equivalent. Starting from the 

etc 166 165 164 163 162 161 160

Consider a hexadecimal number such as 0x80329. To convert it to decimal, you would write:

    8 * 164 + 0 * 163 + 3 * 162 + 2 * 161 + 9 * 160 

= (8 * 65536) + (0 * 4096) + (3 * 256) + (2 * 16) + (9 * 1)

=    524288    +       0        +     768     +    32      +     9

=    525097

Therefore, hexadecimal 0x80329 = decimal 525097

Consider another hexadecimal number such as 0xBE45A6. To convert it to decimal, using the base 16, you would write an equation as:

B * 165 + E * 164 + 4 * 163 + 5 * 162 + A * 161 + 6 * 160

Referring to the table of numeric conversions, you would find out that the decimal equivalent of hexadecimal B is 11, that of E is 14, and that of A is 10. Therefore, you would rewrite the equation as:

    11 * 165          +  14 * 164     +   4 * 163    +  5 * 162  +  10 * 161 +  6 * 160

= (11 * 1048576 ) + (14 * 65536) + (4 * 4096) + (5 * 256) + (10 * 16) + (6 * 1)

= 11534336          +     917504     +    16384    +    1280     +    160     +  6

= 12469670

= 12,469,670

Therefore, hexadecimal 0xBE45A6 = decimal 12469670 or 12,469,670

Practical Learning Practical Learning: Converting a Byte From Hexadecimal to Decimal

 
  1. Click the Hex radio button and click the buttons to display 80329
     
    Converting a Byte From Hexadecimal to Decimal
  2. Click the Dec radio button to see the result
     
 

Previous Copyright �2005 Susanta K Beura. Next

Hosted by www.Geocities.ws

1