Hexadecimal to Decimal Conversion (with Fractional Part)

A number can be converted from hexadecimal to decimal by following the steps outlined in this post, using the corresponding formula, and referring to the accompanying example. But before we get started, let's take a moment to discuss the meaning of these two numbers.

Hexadecimal to Decimal Conversion Steps

It is necessary to adhere to the rules that are outlined in the following lists in order to convert any hexadecimal number into the decimal system:

  1. Write down the given hexadecimal number.
  2. Write down the weight for different positions.
  3. To get the product, multiply each digit of the given hexadecimal number by the corresponding weight.
  4. Now add all the products to get the decimal equivalent.

Now, let's look at an example and see how we can better understand it by applying the rules that were just discussed.

Now that we have a number written in hexadecimal, let's say it's 1D7F; we need to translate that number into its representation in decimal.

That is, (1D7F)16 = ( ? )10.

The table given below shows you how to apply the first three rules given above to convert hexadecimal to decimal:

1 D or 13 7 F or 15 Given Number
163 162 161 160 Weight

After concentrating on the preceding table, apply rules 3 and 4, and we have

= 1*163 + 13*162 + 7*161 + 15*160
= 4076 + 3328 + 112 + 15
= 7551

which is the decimal equivalent of the given hexadecimal number, that is, 1D7F. Therefore, (1D7F)16 = (7551)10.

Hexadecimal to Decimal Conversion Formula

Let's focus on the area that has been provided for us below, which explains how the hexadecimal number system can be converted into the decimal system. Consider the following scenario, in which the user has provided the hexadecimal input 5A9:

5         A         9
162       161       160
(5*162)   (A*161)   (9*160)

= (5*162) + (10*161) + (9*160)
= 1280 + 160+9
= 1449

As you can see from the above box:

Therefore, when converting 5A9 into decimal, we get 1449. Therefore, (5A9)16 = (1449)10.

The rules presented above are only relevant for hexadecimal input that does not include a decimal point. Let's move on to the next step and learn how to convert numbers written in hexadecimal that contain fractional components into the corresponding value written in decimal.

Hexadecimal (containing a decimal point) to Decimal Conversion

Here is another box that shows the conversion of hexadecimal (with a decimal point) to decimal. Let's suppose that the user has supplied 5A9.63 as hexadecimal input.

5         A         9         6         3
162       161       160       16-1      162
(5*162)   (10*161)  (9*160)   (6*16-1)  (3*16-2)

= (5*162) + (10*161) + (9*160) + (6*16-1) + (3*16-2)
= 1280 + 160 + 9 + 0.375 + 0.01172
= 1449.3867

Programs Created on Hexadecimal to Decimal Conversion

Computer Fundamentals Quiz


« Previous Tutorial Next Tutorial »