DEV Community

Cover image for How to Convert Hexadecimal to Decimal Numbers
Tony Williams
Tony Williams

Posted on

How to Convert Hexadecimal to Decimal Numbers

Hexadecimal (or hex) is a base-16 number system used in computing and mathematics. It uses the digits 0–9 and the letters AF (where A=10, B=11, C=12, D=13, E=14, and F=15). Converting hexadecimal to decimal (base-10) is a straightforward process. Here's a simple guide to help you understand and perform the conversion.

_**Note:  If you want to convert HEX to DEC in a quick second, you can use this online tool.
_
**

Steps to Convert Hexadecimal to Decimal

Identify Each Digit's Position :

Start by writing down the hexadecimal number. Identify the position of each digit, starting from the rightmost digit, which is at position 0. The next digit to the left is at position 1, and so on.

Determine the Decimal Value of Each Digit :

Convert each hex digit to its decimal equivalent. For example, the hex digit 'A' becomes 10, 'B' becomes 11, 'C' becomes 12, and so on up to 'F', which becomes 15. Digits 0–9 remain the same.

Multiply Each Digit by 16 Raised to the Power of Its Position :

Multiply each decimal value by 16 raised to the power of its position. For example, if the digit is at position 2, multiply by 16216²¹⁶².

Sum All the Results :

Add all the results from the previous step together. The sum is the decimal equivalent of the hexadecimal number.
Example Conversion

Let's convert the hexadecimal number 1A3 to decimal:

*Identify Each Digit's Position :
*

The hex number is 1A3. The positions are:
3 is at position 0
A is at position 1
1 is at position 2

*Determine the Decimal Value of Each Digit :
*

3 remains 3
A converts to 10
1 remains 1

*Multiply Each Digit by 16 Raised to the Power of Its Position :
*

3×160=3×1=33 \times 16⁰ = 3 \times 1 = 33×160=3×1=3
10×161=10×16=16010 \times 16¹ = 10 \times 16 = 16010×161=10×16=160
1×162=1×256=2561 \times 16² = 1 \times 256 = 2561×162=1×256=256

Sum All the Results :

3+160+256=4193 + 160 + 256 = 4193+160+256=419

So, the decimal equivalent of the hexadecimal number 1A3 is 419.

Conclusion

Converting hexadecimal numbers to decimals involves understanding the value of each hex digit, its position, and then performing some simple multiplications and additions. By following these steps — identifying positions, converting to decimal, multiplying by powers of 16, and summing up — you can easily convert any hexadecimal number to its decimal form. This process is essential in computing and helps in understanding how different number systems work.

Top comments (0)