# Hexadecimal to Decimal Conversion

Before starting to convert hexadecimal numbers in decimal number, go through the following articles:

Let’s start by writing down the first four powers of 16 (we’ll use them in our conversion example):

$\begin{split} 16^0 &= 1 \\ 16^1 &= 16 \\ 16^2 &= 256 \\ 16^3 &= 4096 \end{split}$

For example, let’s convert the hexadecimal number 0xFACE into a decimal number.

### Method 1

This method is straightforward and it’s using the powers of 16.

Step 1. Convert each of the hexadecimal symbols into decimal symbols, as follows:

 Hexadecimal F A C E Decimal 15 10 12 14

Step 2. Multiply each of the decimal numbers with the corresponding power of 16, as follows:

 Decimal 15 10 12 14 Powers of 16 163 162 161 160 Multiplication 15·163 10·162 12·161 14·160

Step 3. Add the products of all multiplication operations. The result is going to be the decimal number.

$\bbox[#FFFF9D]{15 \cdot 4096 + 10 \cdot 256 + 12 \cdot 16 + 14 \cdot 1 = 64206}$

The hexadecimal number 0xFACE converted to decimal is 64206.

### Method 2

This method is not as direct as the first one, but it’s easier to execute because it does not involve heavy multiplications. It can also be performed without a calculator or software. The principle of this method is to use a hexadecimal to binary transformation first and a binary to decimal conversion second.

A hexadecimal number can be represented on 4 bits. For example, the highest symbol in hexadecimal notation is F, which in binary is 0b1111.

Step 1. Convert the hexadecimal numbers into binary, as follows:

 Hexadecimal F A C E Decimal 15 10 12 14 Binary 1111 1010 1100 1110

Step 2. Concatenate the four binary numbers into one, as follows:

1111101011001110

Step 3. Convert the binary number into decimal, using the powers of 2:

$\begin{split} 1 \cdot 2^{15}+1 \cdot 2^{14}+1 \cdot 2^{13}+1 \cdot 2^{12}+1 \cdot 2^{11}+0 \cdot 2^{10}+1 \cdot 2^9+ …\\ 0 \cdot 2^8+1 \cdot 2^7+1 \cdot 2^6+0 \cdot 2^5+0 \cdot 2^4+1 \cdot 2^3+1 \cdot 2^2+1 \cdot 2^1+0 \cdot 2^0 \end{split}$

Step 4. Perform the sum of the multiplications to get the decimal number

$32768+16384+8192+4096+2048+512+128+64+8+4+2=64206$

As you can see, we obtained the same result with both methods. The advantage of the second one is that it deals with simpler multiplications and can be performed without a handheld calculator or software.

Of course, we can also use the Scilab function hex2dec() to convert from hexadecimal to decimal.

--> hex2dec('FACE')

ans =
 64206.

-->

For any questions, observations and queries regarding this article, use the comment form below.

Don’t forget to Like, Share and Subscribe!

#### Ad Blocker Detected

Dear user, Our website provides free and high quality content by displaying ads to our visitors. Please support us by disabling your Ad blocker for our site. Thank you!