CONVERTING HEXADECIMAL TO DECIMAL

  Steps:
  1. Get the last digit of the hex number, call this digit the currentDigit.  
  2. Make a variable, let's call it power.  Set the value to 0.
  3. Multiply the current digit with (16^power), store the result.
  4. Increment power by 1.
  5. Set the the currentDigit to the previous digit of the hex number.
  6. Repeat from step 3 until all digits have been multiplied.
  7. Sum the result of step 3 to get the answer number.

Example 1 
Convert the number 1128 HEXADECIMAL to DECIMAL

MULTIPLICATION RESULT NOTES
8 x (16^0) 8 Start from the last digit of the number.  In this case, the number is 1128.  The last digit of that number is 8.  Note that any number the power of 0 is always 1 
Also note the notation (16^0) means 160, and (16^1) means 161, and (16^2) means 162, and so on.
2 x (16^1) 32 Process the previous, which is 2.  Multiply that number with an increasing power of 16.
1 x (16^2) 256 Process the previous digit, which is 1, note that 16^2 means 162 or 16 x 16
1 x (16^3) 4096 Process the previous digit, which is 1, note that 16^3 means 16 x 16 x 16
    Here, we stop because there's no more digit to process
ANSWER 4392 This number comes from the sum of the RESULTS 
(8+32+256+4096)=4392

Once discerned, notice that the above process is essentially performing this calculation:

1x(16^3) + 1x(16^2) + 2x(16^1) + 8x(16^0) 

When doing this by hand, it is easier to start backward is because:

  • Counting the number of digits takes extra time, and you might count wrongly.
  • If you don't remember what a particular value of 16 to the power of n, it's easier to calculate it from the previous power of n value.  For instance, if you don't remember what the value of 16^3 is, then just multiply the value of 16^2 (which you'll likely already have if you started backward) with 16.

Example 2 
Convert the number 589 HEXADECIMAL to DECIMAL

MULTIPLICATION RESULT
 9 x (16^0) 9
 8 x (16^1) 128
 5 x (16^2) 1280
   
ANSWER 1417

If you want to be a speed counter, it's beneficial to memorize the values of the smaller power of 16s, such as in this table

POWER OF 16s RESULT
 16^0 1
 16^1 = 16 16
 16^2 = 16x16 256
 16^3 = 16x16x16 4096
 16^4 = 16x16x16x16 65536

Example 3
Convert the number 1531 HEXADECIMAL to DECIMAL
(This time, let's use the table of the power-of-16s above.)

MULTIPLICATION RESULT
1 x 1 1
3 x 16 48
5 x 256 1280
1 x 4096 4096
   
ANSWER 5425

Example 4
Convert the number FA8 HEXADECIMAL to HEXADECIMAL

MULTIPLICATION RESULT
8 x 1 8
A x 16 (remember that hex A=decimal 10) 160
F x 256 (remember that hex F=decimal 15) 3840
   
ANSWER 4008

Example 5
Convert the number 8F HEXADECIMAL to DECIMAL

DIVISION RESULT
F x 1 15
8 x 16 128
   
ANSWER 143

Example 6
Convert the number A0 HEXADECIMAL to DECIMAL

DIVISION RESULT
0 x 1 0
A x 16 160
   
ANSWER 160

Example 7
Convert the number 12 HEXADECIMAL to DECIMAL

DIVISION RESULT
2 x 1 2
1 x 16 16
   
ANSWER 18

 

Example 8
Convert the number 35432 HEXADECIMAL to DECIMAL

2x(16^0) + 3x(16^1) + 4x(16^2) + 5x(16^3) + 3x(16^4) =
2 + 3x16 + 4*256 + 5*4096 + 3*65536 =
2 + 48 + 1024 + 20480 + 196608 = 
218162

Advertisement

 

Test your hex-to-dec knowledge. Take the Quiz Now (Beta)

 

(C) F. Permadi

<<INDEX>>

permadi@permadi.com
10/2001