# How to Convert Decimal to Hexadecimal in 4 Easy Steps

In this post, we will go through the detailed steps for converting a given number from decimal to hexadecimal. 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:

### Example 1 : Convert (5049)10 decimal to Hexadecimal 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).

## Decimal Fraction to Hexadecimal fraction

In the earlier post we discussed the integer conversion of a given decimal number to its equivalent hexadecimal number.

The method involved in the conversion of fractional decimal to hexadecimal fraction is different, in this post we will only concentrate on the fractional conversion.

## How to Convert Decimal Fraction to Hexadecimal [Steps]

The steps for the conversion are given below:

Successive multiplication is used to convert a given fractional decimal to hexadecimal fraction equivalent.

1. Here the given decimal fraction is successively multiplied by the base of the target number system (16, here it is hexadecimal system).
2. During each multiplication iteration, the product generated will have a carry (integer part of the product) and a fractional part.
3. The carry obtained at each multiplication step becomes a numeral in the hexadecimal fraction.
4. The fractional part of the product is again multiplied by base 16 in the next step and the process is repeated until the fractional part becomes zero or the number of multiplication iteration equals the number of digits after the decimal point in the given decimal fraction.
5. Weights are assigned for the carry obtained at each multiplication step in the increasing order starting from the first multiplication step to the last step, such that the carry obtained in the first multiplication iteration is the most significant bit (MSD) after the decimal point and the carry obtained in the last multiplication iteration is the least significant bit (LSD).
6. This procedure is illustrated in the following example.

### Example 1 : Convert (0.0628)10 decimal to hexadecimal fraction (?)16 using successive multiplication method

1st Multiplication Iteration

``````Multiply 0.0628 by 16

0.0628 x 16 = 1.0048(Product)    Fractional part=0.0048      Carry=1 (MSD)``````

2nd Multiplication Iteration

``````Multiply 0.0048 by 16

0.0048 x 16 = 0.0768(Product)    Fractional part = 0.0768    Carry=0``````

3rd Multiplication Iteration

``````Multiply 0.0768 by 16

0.0768 x 16 = 1.2288(Product)    Fractional part = 0.2288    Carry=1``````

4th Multiplication Iteration

``````Multiply 0.2288 by 16

0.2288 x 16 = 3.6608(Product)    Fractional part = 0.6608    Carry=3 (LSD)  ``````

Here the fractional part doesn’t become zero but we obtain required number of significant digits after the decimal point. Thus we stop the multiplication iteration and assign the weights to the digits obtained in each multiplication step in the increasing order starting from the 1st multiplication step to last multiplication step.

Carry from the 1st multiplication iteration becomes MSB and carry from 4th iteration becomes LSB after the decimal point.

Hence, the fractional hexadecimal number of the given decimal fraction
(0.0628)10 is (0.1013)16.