- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# How to Convert Hexadecimal to Decimal?

Whereas **Hexadecimal** number is one of the number systems which has value is 16 and it has only 16 symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 and A, B, C, D, E, F. Where A, B, C, D, E and F are single bit representations of decimal value 10, 11, 12, 13, 14 and 15 respectively. Whereas **Decimal** system is most familiar number system to the general public. It is base 10 which has only 10 symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9.

## Conversion from Hexadecimal to Decimal number system

There are various indirect or direct methods to convert a hexadecimal number into decimal number. In an indirect method, you need to convert a hexadecimal number into binary or octal number, then you can convert it into decimal number.

**Example** − Convert hexadecimal number F1 into decimal number.

First convert it into binary or octal number, = (F1)_{16}= (1111 0001)_{2}or (011 110 001)_{2}Because in binary, value of F and 1 are 1111 and 0001 respectively. Then convert it into decimal number multiplying power of its position of base. = (1x2^{7}+1x2^{6}+1x2^{5}+1x2^{4}+0x2^{3}+0x2^{2}+0x2^{1}+1x2^{0})_{10}or(3 6 1)_{8}= (1x2

^{7}+1x2^{6}+1x2^{5}+1x2^{4}+0x2^{3}+0x2^{2}+0x2^{1}+1x2^{0})_{10}or (3x8^{2}+6x8^{1}+1x8^{0})10 = (241)_{10}

However, there is a simple direct method to convert a hexadecimal number to decimal number. Since, there are only 16 digits (from 0 to 7 and A to F) in hexadecimal number system, so we can represent any digit of hexadecimal number system using only 4 bit as following below.

Hexa | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |

Binary | 0000 | 0001 | 0010 | 0011 | 0100 | 0101 | 0110 | 0111 |

Hexa | 8 | 9 | A=10 | B=11 | C=12 | D=13 | E=14 | F=15 |

Binary | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 |

Hexadecimal number system provides convenient way of converting large binary numbers into more compact and smaller groups. These are weights of hexadecimal of respective position of hexadecimal (value of base is 16).

Most Significant Bit (MSB) | Hexa Point | Least Significant Bit (LSB) | |||
---|---|---|---|---|---|

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

256 | 16 | 1 | 1/16 | 1/256 | 1/4096 |

Since number numbers are type of positional number system. That means weight of the positions from right to left are as 16^{0}, 16^{1}, 16^{2}, 16^{3}and so on. for the integer part and weight of the positions from left to right are as 16^{-1}, 16^{-2}, 16^{-3}and so on. for the fractional part.

You can directly convert a hexadecimal number into decimal number using reverse method of decimal to hexadecimal number.

Assume any unsigned hexadecimal number is h_{n}h_{(n-1)} ... h_{1}h_{0}.h_{-1}h_{-2} ... h_{(m-1)}h_{m}. Then the decimal number is equal to the sum of hexadecimal digits (hn) times their power of 16 (16n), i.e.,

= h_{n}h_{(n-1)} ... h_{1}h_{0}.h_{-1}h_{-2} ... h_{(m-1)}h_{m}

= h_{n}x16^{n}+h_{(n-1)}x16^{(n-1)}+ ... +h_{1}x16^{1}+h_{0}x16^{0}+h_{-1}x16^{-1}+h_{-2}x16^{-2}+ ... +h_{(m-1)}x16^{-(m-1)}+h_{-m}x16^{-m}

This is simple algorithm where you have to multiply positional value of binary with their digit and get the sum of these steps.

**Example-1** − Convert hexadecimal number ABCDEF into decimal number.

Since value of Symbols − A, B, C, D, E, F are 10, 11, 12, 13, 14, 15 respectively. Therefore equivalent decimal number is,

= (ABCDEF)_{16}= (10x16^{5}+11x16^{4}+12x16^{3}+13x16^{2}+14x16^{1}+15x16^{0})_{10}= (10485760+720896+49152+3328+224+15)

_{10}= (11259375)_{10}which is answer.

**Example-2** − Convert hexadecimal number 1F.01B into decimal number.

Since value of Symbols: B and F are 11 and 15 respectively. Therefore equivalent decimal number is,

= (1F.01B)_{16}= (1x16^{1}+15x16^{0}+0x16^{-1}+1x16^{-2}+11x16^{-3})_{10}= (31.0065918)_{10}which is answer.

- Related Questions & Answers
- How to Convert Decimal to Hexadecimal?
- How to convert Decimal to Hexadecimal in Java
- How to convert decimal to hexadecimal in JavaScript?
- Java Program to convert from decimal to hexadecimal
- Convert decimal integer to hexadecimal number in Java
- Java program to convert decimal number to hexadecimal number
- Java Program to convert hexadecimal number to decimal number
- Java Program to convert decimal integer to hexadecimal number
- How to Convert Decimal to Binary, Octal, and Hexadecimal using Python?
- How to Convert Binary to Hexadecimal?
- C++ program for hexadecimal to decimal
- How to Convert Binary to Decimal?
- How to Convert Decimal to Binary?
- How to Convert Decimal to Octal?
- Program for decimal to hexadecimal conversion in C++