Decimal to Hexadecimal, Hexadecimal to Decimal: Adding
67
Many textbooks are written to explain the hexadecimal but few show
how to convert a hexadecimal number into decimal and the other way
around. If you are studying a foundation degree in IT or Information
Systems and Management and you are hopeless don't worry, here you will
get it right. I promise to use plain words to brake this down.
First thing, the hexadecimal goes like this 1,2,3,4,5,6,7,8,9,A,B,C,D,E,F. If we count in decimal we will arrive to number 15. That means that A is 10, B is 11, C is 12, D is 13, E is 14 and F is 15.
And
that is clear! Even so, what happens after F? I think that is what you need
to know in order to calculate it easy, and what no text book has
appeared to mention.
After F: F+1=10(16 in decimal)
F+2=11(17 decimal), F+3=12(18 decimal)
F+4= 13(19 decimal), F+5=14(20 decimal)
F+6=15(21 decimal), F+7=16(22 decimal)
F+8= 17(23 decimal), F+9=18(24 decimal)
F+A= 19(25 decimal),
F+B=1A(26 decimal), F+C=1B(27 decimal)
F+F=1C(28 decimal).
If you need to i.e. F+B=1A you write down A and carry the 1 to the next column
Adding hexadecimal numbers
4F
+ FB
----------
14A
Here you have F+B=1A, you write down A and you carry 1 to the next column, there you have 4+F=13+1(that we carried)=14. so the result is 14A, but this result is in hexadecimal. If your question requires now to convert this to decimal this is the easiest way to do it.
14A =hexadecimal is a base of 16. This means that if you need to convert this to decimal you need to multiply by 16, starting from the right with 160. Hence, 160 then 161, then 162 and so on.
In our case we have three hex numbers 14A and we do simply this:
1x162+ 4x161+ Ax160 (A is 10 and you can find this from the hex table)
1x162+ 4x161+ 10x160 =256+ 64+10(because 160 =1)= 330
Hence, 14A= 330 in decimal
The
best way is first to add or subtract in hexadecimal and when you have
the result to simply do this operation with the base of 16. On your
exam you are not allowed to use your calculator, so use it only to
check your results, when you practice, again not on your exam.
Lets do now a more advanced adding in hexadecimal
AB3FC
+37CFD
-----------
E30F9 (final result explained below)
Here is the result already, and if you can manage to understand this than you will be able to add any number in hexadecimal.
1. ADDING C+D=19, write down 9 and carry 1
C+D=19 (in hexadecimal) Why?
Because after the hexadecimal C from the table we have D,E,F,10,11,12,13,14,15,16,17,18,19
From D to 9, we have 13 numbers, which equals D.
Therefore, C+D=19(remember, 19 is a hex number, not decimal)
I will remind you again that before the hexadecimal F, we never carry 1, after the F we do carry 1.
So
that means that if you add two hex numbers and the sum is less than F
than you don't need to carry 1 to the next column, just write the sum
down. If you add two numbers which sum is more than F than you must
carry 1 to the next column.
2. ADDING F+F=1E Why?
Because F has 15 numbers, and if we start counting from F up to 15 to get to 1E. Starting from the first one after F: 10,11,12,13,14,15,16,17,18,19, 1A, 1B, 1C, 1D,1E
(if you count all these numbers they add up to 15 which equals F on the hex table). So we have E and we carry 1 from the ->1E to the next column.
Remember
that we had the carry from the first column so E+1=F, now that added
up, we right down F, and we carry one to the third column.
3 ADDING 3+C=F, plus we need to add the one that we carry from the second column and that means we get 10(again, because after F comes 10), so we write down 0 and again we carry 1.
4. ADDING B+7=12 Plus the one that we carry from the last(third) column, we get 13, right down 3 and carry 1, again, to the next column.
5. ADDING A+3=D and we add from the last(forth) column that carries one. We get E.
Because
E is less than F it doesn't carry one to the next column and therefore,
E is the last number. If instead we had 10 we were writing down 0 and
adding 1 after the number E.
(i.e. if we have E, we get this E30F9. If we have 10, we get this 1E30F9). Got it?
Congratulations, now you know how to add in hexadecimal!
The last thing that I can do is to convert the hexadecimal into decimal and from decimal to hexadecimal:
The result is E30F9: now to convert this to decimal we need to use base 16 as you can see below:
Ex164+ 3x163+ 0x162+ Fx161 + 9x160
Now you can see at the table and exchange the letters with numbers, what is needed for E, that is 14 and F that is 15, hence:
14x164+ 3x163+ 0x162+ 15x161 + 9x160 (remember 160=1)=
917504 + 12288 + 0 + 240 + 9 = 930041
Now we need to convert 930041 into hexadecimal and this is one possible way
930041:16 = 58127.563
We split the first result 58127 from 0.563, and we divide again 58127 by 16.
The remainder is multiplied 0.563 by 16
0.563x16=9 (forget the reminder here)
and this number is the first hexadecimal starting from the right _ _ _ _ 9
We need to repeat this process dividing by 16 until we find all the numbers that will line up from right to left.
58127:16= 3632.94
We split again and we get 3632 and 0.94
0.94x16=15 (which in hex is F, you need to remember to convert this!)
Now we have the second hex number starting from the right and that is
_ _ _ F 9
Now it's simple, you can simply carry on
3632:16=227
(remainder
is 0, so the third number, indeed, is 0. If you don't see a comma you
don't need to calculate the remainder, is always zero)
_ _ 0 F 9
227:16 = 14.186
We split 14 from 0.186
0.186x16=2.98 (which is 3, every decimal equal or over 2.5 can be rounded 3)
_ 3 0 F 9
We are now calculating the last number
14:16 = 0.875
If we are below 1(alike 0.875) that means that you are calculating your last number! Yup!
0.875x16=14 (which in hexadecimal is E)
henceforth,
E 3 0 F 9, is your final result. And the one that we've got when we added 2 hex numbers.
Hope you found this useful,and if you have any problems just leave a comment and I can help you out.
PrintShare it! — Rate it: up down flag this hub
Comments
Wow, that is something to do addition or subtraction in various bases. I never tried that before,..it must be quite involved, but very interesting.
Thanks for your comment, this hub should be helping the students from October:).
You've really put this topic on the level,I do a little program debugging and game tweaking as a hobby on my own,this kind of math comes in handy when not using a calculator!
Thanks Waren E, I'm glad you find this Hub useful! And more will be coming soon related to hexadecimal conversion.






GreenMathDr says:
3 months ago
Yes doing this makes it seem easy to think in the bases less than 10. When I was in about the 3rd grade we had to do addition and subtraction in the various bases in order to prepare us for bases above 10. It was a short lived idea in the "American" "New Math" but it is the type of thing that enhances one's concept of bases.