Table of Contents

Last modified on August 3rd, 2023

chapter outline

 

Decimal to Hexadecimal

The decimal number system, the most widely used in the oldest numeral system, consists of numbers with the base of 10.  It has 10 notations, starting from 0 to 9.

In contrast, the hexadecimal number system consists of numbers with the base of 16. It has 16 notations starting from 0 to 15, where 10 to 15 are expressed with alphabets A to F.

Converting a decimal to a hexadecimal means writing it in its hexadecimal equivalent.

Formula

The formula to convert a decimal to hexadecimal is:

Decimal Number = dn-1 × 16r-1+….+ d2 × 162 + d1 × 161 + d0 × 160, here n = number of digits, r = place of the digit

In general we convert a decimal to hexadecimal with successive division method as shown in the example below.

Decimal to Hexadecimal

The steps are:

  1. Divide the number by 16. Note the remainder separately in a column. If the remainder is greater than 16, convert it to hexadecimal alongside. Suppose the remainder is 4, then it will be 4 in hexadecimal also. However, if it is 12, then the hexadecimal remainder is C.
  2. Write the integer quotient for the next iteration.
  3. Divide it again by 16. Note the remainder again, and write it in hexadecimal wherever required.
  4. Repeat the division process until the quotient is zero. Write the remainder from the bottom to the top. This number is the hexadecimal number.

Convert 9124 to hexadecimal.

Solution:

The solution is given in the figure alongside.
We get (9124)10 = (23A4)16

converting a DECIMAL NUMBER with a FRACTIONAL PART to a hexadecimal equivalent

(1020.1)10 to hexadecimal.

Solution:

The integer 1020 is successively divided by 16:
1020/16 →  63 R 12  →  C in hex
63/16 →  3 R 15  →  F in hex
3/16 →  0 R 3  →  3 in hex (we stop the process since Q = 0)
For integer, we write the remainders from bottom to up.
So, the hexadecimal equivalent for the integer part is 3FC.
Now let us work with the fractional part, i.e., 0.1
Multiplying it with 16 till we feel that the process isn’t going to stop.
0.1 × 16 →  1.6  →  1   (1.6 – 1 = 0.6)
0.6 × 16 →  9.6  →  9   (9.6 – 9 = 0.6)
0.6 × 16 →  9.6  →  9   (9.6 – 9 = 0.6)
0.6 × 16 →  9.6  →  9   (9.6 – 9 = 0.6)
It is endless. So we stop the iteration right here.
For fractional part, we write the remainders from top to bottom. (Here we take the remainders till 4 significant digits)
∴ hexadecimal equivalent for the fractional part = .1999
∴ (1020.1)10  = (3FC.1999)16

(23.625)10 = ( ? )16

Solution:

We will divide 23 by 16
23 ÷ 16 = 1 R 7
 1 ÷ 16 = 0 R 1
Writing the remainders from the bottom up, we get 17
Now, we will multiply the decimal number with 16 separately to eliminate the decimal separator,
 0.625 × 16 = 0.0 + 10  →  A
And, putting A with a decimal point after 17, the final hex equivalent is 17.A
∴(23.625)10 = (17.A)16

(724.25)10 = ( ? )16

Solution:

For integer part, dividing by 16:
724 ÷ 16 = 45 R 4
45 ÷ 16 = 2 R 13
2  ÷ 16 = 0 R 2
The hexadecimal is 2D4
For the fractional part:
0.25 × 16 →  4.00  →  4 (4.00 – 4 = 0.00)
0.00 × 16 →  0.00  (stopping the process here)
so, (724.25)10 = (2D4.4)16 or (2D4.4)H

Conversion Table

A reference chart is shown below which can help us to convert decimal to hexadecimal or other numbers like binary.

Decimal to Hexadecimal Table

Last modified on August 3rd, 2023

Leave a comment

Your email address will not be published. Required fields are marked *