Before starting to convert from decimal to hexadecimal we need to know about this two number systems. Decimal and hexadecimal are two very important number systems.
Decimal is the daily used number system where we use the digits from 0 to 9 for writing any number. We actually use this number system everyday to calculating anything.
On the other hand, hexadecimal is the 16 based number system where we use all the decimal digits as well as some alphabet like A, B, C, D, E and F.
Hexadecimal number system is used in computer systems in different fields. A well known example of using hexadecimal number is HTML color code. You may have familiar with this.
However, this is not my discussing point today. In this blog, I am going to teach you everything about decimal to hexadecimal conversion with a few examples.
We will use two rules for converting a number from decimal to hexadecimal. We know that the base of decimal is 10 where hexadecimal is 16.
To convert a number we have to know two rules which are given bellow separately for integer and fraction part.
Table of Contents
Convert from decimal to hexadecimal
Rules for integer part
- Divide the decimal number by the base of hexadecimal number (16) and write the reminder.
- Divide the result again by 16 and write the reminder and continue this process until you get 0 at the result.
- Now write down the remainder in opposite order which will be the hexadecimal equivalent of given decimal number.
It seems that, these rules are very hard to memorize. But, no problem, you will learn everything here. I will make it more simple to you by an example conversion from decimal to hexadecimal.
Let’s see the example conversion from decimal to hexadecimal to learn these rules.
Example: Conversion of (450)_{10} to hexadecimal number
We can convert the number using two way. The two way is given separately here. Let’s try to understand them. For both cases we have divided the number by the base of it and taken the reminder in reverse order.
At the first figure bellow, we have divided the number 450 by the base of hexadecimal number 16 and written the reminder which is 2.
Then we have again divided the result 18 by the base 16. This gives us the reminder 12 which is equivalent to the hex digit C. Then again the same process for the last 1.
Obviously you can use any one of the given method to convert the number. Here, the direction of arrow indicates the order of hexadecimal digits which is reverse of the gotten result.
I think, you will be able to convert any integer number from decimal to hexadecimal by applying these rules. Now, you should try your best to implement these rules.
I am going to teach you about the conversion of fraction number from decimal to hexadecimal now. So, let’s learn the rules first to convert the number from decimal to hexadecimal.
Rules for fraction part
- Multiply the fraction part by 16 and write the integer portion.
- Again, multiply the resultant fraction part which you have got from the first process and write down the integer part and continue this process until you get zero at the fraction part (minimum 4 to 5 times if it repeats).
- Now write down the integers you have got at the same order you have got them.
Now, let’s see an example conversion of fraction number from decimal to hex. We will just implement the given rules in this example.
Example : Convert (0.78125)_{10} to equivalent hexadecimal number
To convert this fraction number from decimal to hexadecimal we have to multiply the number by 16 and write the integer portion in given direction.
As like as the given rules, we have multiplied the given decimal number by the base of hex number 16 and written the integer part.
Again multiply the fraction porting by 16 and write the integer part. Continue the process until you get zero at the result. If you don’t get zero then take the required number after the radix point.
Direction of arrow indicates the order of priority for taking hexadecimal digits. We have got here the hex equivalent is .C8
Now, I hope you are more clear about the whole conversion method. Because if you can convert the integer part and fraction part separately, then it is very easy to convert any number from decimal to hexadecimal.
Now, let’s see a complete example bellow to convert a number from decimal to hexadecimal. If you have any doubt still now, then this will be very helpful for you.
Example: Convert (125.85)_{10} to hexadecimal number
We will convert its integer part and fraction part separately for converting this number from decimal to hexadecimal.
At first you should try this in your own then see the answer. Remember the priority of taking digits which is given here by the direction of arrow.
We will see the conversion of integer portion first.
We have used the rules for converting which we have mentioned above. Now, we will convert its fraction part to equivalent hexadecimal number.
After converting this number we have got the total hexadecimal equivalence is (7D.D99…)_{10} . However, you try to convert some other number using these rules. The process will be same. So, try this.
I hope, this post was very helpful for you to learn this conversion from decimal to hexadecimal. I have tried my best to discus almost every details here.
This is now totally depend up to you that how much will you be expert to this conversion by practicing yourself.
If you have any query then tell us in the comment section bellow. We are very font of here from you. If you find any unexpected mistake here then please tell us. Thanks for remaining with us.
This information is priceless. Where can I find out more?
I’ve been exploring for a bit for any high quality articles or weblog posts in this sort of area .
Exploring in Yahoo I ultimately stumbled upon this site.
Reading this information So i’m happy to convey that
I have a very good uncanny feeling I found out exactly what I needed.
I such a lot for sure will make certain to do not fail to remember this website
and give it a look regularly.
When I originally commented I seem to have clicked the -Notify me when new comments are added- checkbox
and now every time a comment is added I get four emails with the
exact same comment. There has to be a means you can remove me from
that service? Cheers!
Just want to say your article is as surprising. The clarity on your publish is
simply great and that i could suppose you are a professional on this subject.
Well together with your permission allow me to grasp your feed to
stay up to date with drawing close post. Thanks one million and please carry on the enjoyable work.