# How to use the HEX2DEC function

The HEX2DEC function converts a hexadecimal number to a decimal number.

##### What is a hexadecimal number?

A hexadecimal number is a numeral system with a base of 16, for example, the decimal system uses a base of 10. This means that each digit in a hexadecimal number can have 16 possible values, from 0 to 15, however, the letters A to F are used from 10 to 15. See the hexadecimal column in the table below.

Hexadecimal numbers are often used in computers, the reason is they represent four binary digits (bits) with one hexadecimal digit. For example, the binary number 1010 is equivalent to the hexadecimal number A.

Hexadecimals make it easier to write big numbers with less digits, in other words, hexadecimals shorten binary digits considerably. For example, we can use hexadecimal to show the values of colors and MAC addresses in computers.

**What is a decimal number?
**The decimal system is a positional numeral system that uses 10 as the base, it requires 10 different numerals: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. The dot or the decimal point represents decimal fractions which are not whole numbers.

The decimal number 520 has three positions, each with a different weight. It starts with 10^0 on the right and increases by one power on each additional position to the left.

520 = (**5***10^2)+(**2***10^1)+(**0***10^0)

520 = 500 + 20 + 0

### Table of Contents

## 1. HEX2DEC Function Syntax

HEX2DEC(*number*)

## 2. HEX2DEC Arguments

number |
Required. The hexadecimal number you want to convert to a decimal number. The sign bit is the most significant bit, the remaining 39 bits are magnitude bits. Negative numbers are represented using two's-complement notation. |

##### What is a sign bit?

The sign bit indicates whether the hexadecimal number is positive or negative, if the bit is 0 the number is positive, if the bit is 1, the number is negative.

##### What is a magnitude bit?

The remaining 39 bits are magnitude bits which represents the absolute value of the number. An absolute number is a number without the sign.

##### What is two's-complement notation?

Twoâ€™s-complement notation is used to represent negative numbers, the magnitude bits are changed from 0 to 1 and 1 to 0 and adding 1 to the result. For example:

Hexadecimal number 7FFFFFFFFF using 10 bits is 0111 1111 1111 1111 1111 1111 1111 1111 1111 1111 which is a positive decimal number.

Hexadecimal number 8FFFFFFFFF using 10 bits is 1000 1111 1111 1111 1111 1111 1111 1111 1111 1111 which is a negative decimal number.

## 3. HEX2DEC Function Example

The image above demonstrates the HEX2DEC function cell C3, C4, C5, and C6. It calculates the decimal values based on the corresponding cells which contain different hexadecimal numbers.

Formula in cell D3:

The first cell B3 contains 1 and the HEX2DEC function returns 1 in cell C3, the second cell B4 contains F and the HEX2DEC function returns 15 in cell C4.

The third cell B5 contains FFFFFFFFFF and the HEX2DEC function returns -1 in cell C5, the fourth cell B6 contains FFFFFFFFFE and the HEX2DEC function returns -2 in cell C6.

## 4. How is hexadecimal to decimal calculated?

Hexadecimal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |

Decimal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |

xyz

becomes

x * (16 ^ 2)

y * (16 ^ 1)

z * (16 ^ 0)

equals

x * (16 ^ 2) + y * (16 ^ 1)Â + z * (16 ^ 0)

### 4.1 Example 1

Hexadecimal value 664 is calculated to decimal like this:

Third hexadecimal value: 6*16^2 = 6*256 = 1536

Second hexadecimal value: 6*16^1 = 6*16 = 96

First hexadecimal value: 4*16^0 = 4*1 = 4

1536+96+4

equals

1636.

### 4.2 Example 2

Hexadecimal value F9F is calculated to decimal like this:

F = 15, see the table above. F is the third character from the right. 15*16^2 = 3840

9 is the second character from the right. 9*16^1=144

F = 15

Add the numbers: 3840 + 144 + 15 equals 3999

### External links

Hexadecimal to decimal

Hexadecimal to Decimal converter

Hexadecimal to Decimal - Cuemath

### '' function examples

This formula decodes a URL-encoded string, replacing specific percentage symbol (%) and a hexadecimal number with non-alphanumeric characters. Excel 365 […]

What's on this page Reverse text Insert random characters Convert letters to numbers How to shuffle characters in the alphabet […]

### Functions in 'Engineering' category

The HEX2DEC function function is one of 42 functions in the 'Engineering' category.

## How to comment

How to add a formula to your comment<code>Insert your formula here.</code>

Convert less than and larger than signsUse html character entities instead of less than and larger than signs.

< becomes < and > becomes >

How to add VBA code to your comment[vb 1="vbnet" language=","]

Put your VBA code here.

[/vb]

How to add a picture to your comment:Upload picture to postimage.org or imgur

Paste image link to your comment.

Contact OscarYou can contact me through this contact form