The **DEC2HEX **is an *Engineering *function that converts a hexadecimal number into a decimal number. In this guide, we’re going to show you how to use the **DEC2HEX **function and also go over some tips and error handling methods.

## Supported versions

- All Excel versions

## DEC2HEX Function Syntax

## Arguments

number |
The decimal number you want to convert. |

[places] |
Optional. The number of digits. Excel pads the return value with zeros up to the specified number of digits. If omitted, returns the minimum number of characters required. |

## DEC2HEX Function Example

The **DEC2HEX** function is actually very easy to use. Since the **[places]** argument is optional, you can use the function by supplying a decimal number. The **DEC2HEX** function returns the given number’s decimal equivalent.

Add **[places]** argument to specify a minimum number of characters necessary for the return hexadecimal value. The function adds as many zeros as necessary to match the required character length. For example, *69630* is equal to *10FFE* in hexadecimal base. If the **[places]** argument is 8, you will get *00010FFE *from the formula.

## Tips

- If the hexadecimal number contains letters, the return value is considered as a string value, not a number.
- If the
**number**argument is negative, places is ignored and the**DEC2HEX**function returns a 10-character (40-bit) hexadecimal number in which the most significant bit is the sign bit. The remaining 39 bits are magnitude bits. Negative numbers are represented using two’s-complement notation. - You can convert a given hexadecimal number into a decimal with
**HEX2DEC** - Other related functions:

## Issues

### #NUM!

- If the
**number**is not a valid decimal number,**DEC2HEX**function returns the*#NUM!*error value. - The
**number**should be between*-549,755,813,888*and*549,755,813,887*. Otherwise, you will get*#NUM!* - If the result has more digits than the number of specified
**[places]**characters, it returns the*#NUM!*error value. For example, DEC2HEX(64,1) returns the error value because the result (*40*) requires two characters.