0% found this document useful (0 votes)
78 views4 pages

Converting Hexadecimal To Decimal

The document provides steps for converting between hexadecimal and decimal numbers. To convert from hexadecimal to decimal, each hexadecimal digit is multiplied by increasing powers of 16 and summed. To convert from decimal to hexadecimal, the decimal number is repeatedly divided by 16 and the remainders written in hexadecimal form from lowest to highest place value. Examples are given to demonstrate both conversion processes.

Uploaded by

Prince Adewale
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views4 pages

Converting Hexadecimal To Decimal

The document provides steps for converting between hexadecimal and decimal numbers. To convert from hexadecimal to decimal, each hexadecimal digit is multiplied by increasing powers of 16 and summed. To convert from decimal to hexadecimal, the decimal number is repeatedly divided by 16 and the remainders written in hexadecimal form from lowest to highest place value. Examples are given to demonstrate both conversion processes.

Uploaded by

Prince Adewale
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

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


Start from the last digit of the
number.  In this case, the
number is 1128.  The last digit
8 x (16^0) 8
of that number is 8.  Note that
the power of 0 of any number is
always 1 
 
Process the previous, which
2 x (16^1) 32 is2.  Multiply that number with
an increasing power of 16.
Process the previous digit,
1 x (16^2) 256 which is 1, note that 16^2
means 16 x 16
Process the previous digit,
1 x (16^3) 4096 which is 1, note that 16^3
means 16 x 16 x 16
Here, we stop because there's
   
no more digit to process
This number comes from
ANSWER 4392 thesum 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 a power-of-
16 is, it's easier to calculate it from the previous power 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
1x1 1
3 x 16 48
5 x 256 1280
1 x 4096 4096
   
ANSWER 5425

CONVERTING DECIMAL TO HEXADECIMAL


Steps:

1. Divide the decimal number by 16.   Treat the division as an integer division.  
2. Write down the remainder (in hexadecimal).
3. Divide the result again by 16.  Treat the division as an integer division.  
4. Repeat step 2 and 3 until result is 0.
5. The hex value is the digit sequence of the remainders from the last to first.

Note: a remainder in this topic refers to the left over value after performing an integer
division.  

HEXADECIMAL 0 1 2 3 4 5 6 7 8 9 A B C D E F
DECIMAL 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Example 1 
Convert the number 1128 DECIMAL to HEXADECIMAL

REMAINDER (in
NOTES DIVISION RESULT
HEXADECIMAL)
Start by dividing the
number by 16.  

In this case, 1128 divided


by 16 is 70.5.  So the
integer division result is
1128 / 16 70 8
70 (throw out anything
after the decimal point).

The remainder is (70.5 -


70) multiplied with 16; or
(0.5 times 16), which is 8.
Then, divide the result
again by 16 

(the number 70 on the


DIVISION column  comes
from the previous
RESULT).

In this case, 70 / 16 4 6
70/16=4.375.  So the
integer division result is 4
(throw out anything after
the decimal point)

The remainder is (0.375


multiplied with 16, which
is 6.
Repeat.   Note here that
4/16=0.25.  So the integer
division result is 0.
4 / 16 0 4
The remainder is (0.25-0)
multiplied with 16, which
is 4.
Stop because the result is
already 0 (0 divided by 16      
will always be 0)
Well, here is the answer.
These numbers come
from the REMAINDER     468
column values (read from
bottom to top)
Side note: You can get the remainder of a division using
the Modulus or % operator.  Ie: 1128%16=8.  

Example 2 
Convert the number 256 DECIMAL to HEXADECIMAL
DIVISION RESULT REMAINDER (in HEX)
256 / 16 16 0
16 / 16 1 0
1 / 16 0 1
     
ANSWER   100

Example 3
Convert the number 921 DECIMAL to HEXADECIMAL

DIVISION RESULT REMAINDER (in HEX)


921 / 16 57 9
57 / 16 3 9
3 / 16 0 3
     
ANSWER   399

You might also like