Practice free

HEX2DEC function

HEX2DEC converts a hexadecimal number to its decimal equivalent. It is common in IT, networking and low-level data work, and negative values use two's-complement notation.

Example

Read it as a sentence: turn the hexadecimal number FF into an ordinary decimal number, which gives 255.

Practice this in the app

Syntax

HEX2DEC(number)

number (required)
The hexadecimal number to convert, given as text or a number. Up to 10 digits.

Returns: The decimal equivalent.

What Excel actually returns

Each formula below was run in desktop Excel. The result is exactly what the cell showed, errors included.

FormulaExcel showsCase
=HEX2DEC("FF") 255 Typical
=HEX2DEC("FFFFFFFFFF") -1 Negative (two's complement)
=HEX2DEC(0) 0 Zero
=HEX2DEC("") 0 Empty string
=HEX2DEC({"1","10"}) 1 Spill
=HEX2DEC(11) 17 Number input (not text)
=HEX2DEC("G1") #NUM! Invalid digit
=HEX2DEC("1FFFFFFFFFF") #NUM! Too long input

Watch out for

  • Input is limited to 10 characters.
  • Negative values use two's-complement notation.

Where it works

Excel
HEX2DEC is in every version of Excel from 2007 on.
Google Sheets
Same name, same behaviour for everyday use.

Part of Engineering functions. Every result on this page was measured in desktop Excel, build 16.0.20527. Last updated .