- Computer Fundamentals Course
- Computer Fundamentals Tutorial
- Block Diagram of a Computer
- The Generation of Computers
- Types of Computers
- Classification of Computers
- Characteristics of Computers
- Applications of Computers
- Central Processing Unit
- Input Devices
- Output Devices
- Computer Memory and Types
- CD, HD, Floppy, and PenDrive
- Types of Computer Languages
- Types and Language Translator
- Number System with Types
- Decimal to Binary
- Decimal to Octal
- Decimal to Hexadecimal
- Binary to Decimal
- Binary to Octal
- Binary to Hexadecimal
- Octal to Decimal
- Octal to Binary
- Octal to Hexadecimal
- Hexadecimal to Decimal
- Hexadecimal to Binary
- Hexadecimal to Octal
- Algorithm and Flowchart
- Selection Sort
- Insertion Sort
- Bubble Sort
- Linear Search
- Binary Search
- Bitwise Operators
- Binary Number Addition
- EBCDIC & ASCII Code
- BCD, Excess-3, 2421, Gray Code
- Unicode Characters

# 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 number**: The hexadecimal number system has a base of 16, therefore it allows 16 digits that can be used to create or form a hexadecimal number. For example: 23F, 43, and 23D4F0, etc.

In other words, a number that consists of 16 digits, which are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F, is considered to be a hexadecimal number. The characters A-F refer to 10–15. That is, A refers to 10, B refers to 11, and so on.**Decimal number**: On the other hand, the decimal number system has a base of 10. Therefore, it has a total of 10 digits, which are 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9, which can be used to form a decimal number. For example: 230, 409, and 23022, etc.

## 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:

- Write down the given hexadecimal number.
- Write down the weight for different positions.
- To get the product, multiply each digit of the given hexadecimal number by the corresponding weight.
- 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 |

16^{3} |
16^{2} |
16^{1} |
16^{0} |
Weight |

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

= 1*16^{3}+ 13*16^{2}+ 7*16^{1}+ 15*16^{0}= 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 16^{2}16^{1}16^{0}(5*16^{2}) (A*16^{1}) (9*16^{0}) = (5*16^{2}) + (10*16^{1}) + (9*16^{0}) = 1280 + 160+9 = 1449

As you can see from the above box:

- First, you have to write every hexadecimal digit.
- Then write 16 as the base and increment its exponent with 0, 1, 2, and so on from right to left below each and every hexadecimal digit.
- Write the multiplication of each hexadecimal digit with the corresponding powers of 16.
- Finally, add all the values as shown in 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 16^{2}16^{1}16^{0}16^{-1}16^{2}(5*16^{2}) (10*16^{1}) (9*16^{0}) (6*16^{-1}) (3*16^{-2}) = (5*16^{2}) + (10*16^{1}) + (9*16^{0}) + (6*16^{-1}) + (3*16^{-2}) = 1280 + 160 + 9 + 0.375 + 0.01172 = 1449.3867

#### Programs Created on Hexadecimal to Decimal Conversion

- Hexadecimal to Decimal in C
- Hexadecimal to Decimal in C++
- Hexadecimal to Decimal in Java
- Hexadecimal to Decimal in Python

« Previous Tutorial Next Tutorial »