Decimal to Hexadecimal

how to convert decimal to hexadecimal
In this post, we will go through the detailed steps for converting a given number from decimal number system to it equivalent in the hexadecimal number system. Here we will only concentrate on conversion of integer decimal number and steps to convert fractional decimal to hexadecimal will be discussed in a separate post.

This conversion also follows the same method of successive division of the given number by the radix or the base of the target number system(here hexadecimal) i.e 16.




How to Convert Decimal to Hexadecimal


  1. Integer part of the given decimal number is successively divided by the radix(base) hexadecimal number system 16 until quotient becomes zero(0).
  2. The reminder obtained for each division, becomes a digit in the hexadecimal number.
  3. The remainders obtained at each division step are assigned weights in the hexadecimal system in the decreasing order starting from the remainder obtained in the last division step to the remainder obtained in the first division step.
  4. The reminder in the last division iteration has the highest weight (MSD) which becomes the left most digit and the reminder obtained in the first division iteration has the lowest weight (LSD) which becomes the right most digit in the hexadecimal number.
  5. The procedure is illustrated in the example below:

Ex1: Convert (5049)10 decimal number to octal number (?)16 using successive division method

1st Division Iteration

Divide 5049 by 16
5049 ÷ 16 = 315(Quotient)                     Reminder=9



2nd Division Iteration

Divide 315 by 16
     315 ÷ 16 = 19(Quotient)                     Reminder=B   



3rd Division Iteration

Divide 19 by 16
     19 ÷ 16 = 1(Quotient)                      Reminder=3   

    
4th Division Iteration

Divide 1 by 16
     1 ÷ 16 = 0(Quotient)                       Reminder=1   


Remainder from the last division iteration (1) becomes MSD and reminder from 1st iteration (9) becomes LSD.

Hence, the hexadecimal equivalent of the decimal number 5049 is (13B9).
comments powered by Disqus