## Converting Decimal to Hexadecimal-

In number system, it is very important to have a good knowledge of how to convert numbers from one base to another base.

In the last article, we discussed-

How to convert a Decimal number to Octal number?

We have learnt that any number can be easily converted from base 10 to any other base using division method and multiplication method.

In this article, we will discuss how to convert any decimal number to Hexadecimal number.

 (Given Number)10  → (?)16

There are two cases possible-

Case-01: For numbers carrying no fractional part

Case-02: For numbers carrying a fractional part

### Case-01: For numbers carrying no fractional part-

To convert the numbers carrying no fractional part from base 10 to base 16, we will use division method.

Division method involves following 2 steps-

### Step-01:

Divide the given number (in base 10) with 16 until the result finally left is less than 16.

### Step-02:

Traverse the result and remainders from bottom to top to get the required number in base 16.

### Example-

Suppose we want to convert a number (2020)10 to base 16.

(2020)10  (?)16

Then using division method, we have- Thus,

 (2020)10  = (7E4)16

### For numbers carrying a fractional part-

Suppose the given number consists of some real part and some fractional part.

To convert such numbers from base 10 to base 16, we will treat the real part and fractional part separately.

### For real part-

To convert the real part of number to base 16, we will use division method as we have used in above example.

### For fractional part-

To convert the fractional part of number to base 16, we will use multiplication method.

Multiplication method involves following steps-

### Step-01:

Multiply the given fractional number with 16 and write the real part and fractional part of result so obtained separately.

### Step-02:

Multiply the fractional part obtained after multiplication in previous step with 16 and write the real part and fractional part of result so obtained separately.

### Step-03:

Recursively apply step-02 until fractional part obtained after multiplication becomes 0.

(In case fractional part does not terminate to 0, we can find the result up to as many places as we want.)

 The series of real part of multiplication results obtained in above steps from top to bottom is the required number in base 16.

Following example illustrates how to apply these steps-

### Example-

Suppose we want to convert a number (2020.65625)10 to base 16.

We will treat the real part and fractional part separately.

### For real part-

The real part (2020)10 will be converted to base 16 in exactly the same manner using division method as we have done above.

So, for real part, we have-

 (2020)10  = (7E4)16

### For fractional part-

The fractional part (0.65625)10 will be converted to base 16 using multiplication method.

Using multiplication method, we have-

 Real part Fractional Part 0.65625 x 16 10 = A 0.5 0.5 x 16 8 0.0

Now, traverse the real part column from top to bottom to obtain the required number in base 16.

Thus,

 (0.65625)10  = (A8)16

### Explanation-

#### Step-01:

Multiply 0.65625 with 16. Result = 10.5. Write 10 (= A in hexadecimal) in real part and 0.5 in fractional part.

#### Step-02:

Multiply 0.5 with 16. Result = 8.0. Write 8 in real part and 0.0 in fractional part.

Since, fractional part becomes 0, so we stop.

Combining the result of real and fractional parts, we have-

 (2020.65625)10  = (7E4.A8)16

## Problem-

Convert the following numbers from base 10 to base 16-

1. (172)10
2. (172.983)10

## Solution-

### 1. (172)10

#### (172)10 → ( ? )16

Using division method, we have- Thus,

 (172)10  = (AC)16

### 2. (172.983)10

#### (172.983)10 → ( ? )16

We will treat the real part and fractional part separately-

### For real part-

• The real part is (172)10
• We will convert the real part from base 10 to base 16 using division method.
• We have already done this in above problem.

Thus,

 (172)10  = (AC)16

### For fractional part-

• The fractional part is (0.983)10
• We will convert the fractional part from base 10 to base 16 using multiplication method.

Using multiplication method, we have-

 Real part Fractional Part 0.983 x 16 15 = F 0.728 0.728 x 16 11 = B 0.648 0.648 x 16 10 = A 0.368 0.368 x 16 5 0.886

Since, the fractional part terminates to 0 after several iterations. So, let us find the value up to 4 decimal places.

Now, traverse the real part column from top to bottom to obtain the required number in base 16.

Thus,

 (0.983)10  = (FBA5)16

Combining the results of real and fractional part, we have-

 (172.983)10  = (AC.FBA5)16

Also read: Converting Decimal to Binary

To gain better understanding of how to convert a Decimal number (Base 10) to a Hexadecimal number (Base 16),

Watch this video

Get more notes and other study material of Number System.

Watch video lectures by visiting our YouTube channel LearnVidFun.