- Trending Categories
- Data Structure
- Operating System
- C Programming
- 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. = (1x27+1x26+1x25+1x24+0x23+0x22+0x21+1x20)10 or (3 6 1)8
= (1x27+1x26+1x25+1x24+0x23+0x22+0x21+1x20)10 or (3x82+6x81+1x80)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.
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)|
Since number numbers are type of positional number system. That means weight of the positions from right to left are as 160, 161, 162, 163and so on. for the integer part and weight of the positions from left to right are as 16-1, 16-2, 16-3and 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 hnh(n-1) ... h1h0.h-1h-2 ... h(m-1)hm. Then the decimal number is equal to the sum of hexadecimal digits (hn) times their power of 16 (16n), i.e.,
= hnh(n-1) ... h1h0.h-1h-2 ... h(m-1)hm
= hnx16n+h(n-1)x16(n-1)+ ... +h1x161+h0x160+h-1x16-1+h-2x16-2+ ... +h(m-1)x16-(m-1)+h-mx16-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 = (10x165+11x164+12x163+13x162+14x161+15x160)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 = (1x161+15x160 +0x16-1+1x16-2+11x16-3)10 = (31.0065918)10 which is answer.
- How to Convert Decimal to Hexadecimal?
- How to convert Decimal to Hexadecimal in Java
- 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++