Practice free

HEX2BIN function

HEX2BIN converts a hexadecimal number to its binary equivalent. It is common in IT, networking and low-level data work, and the result is text, not a number.

Example

Read it as a sentence: turn the hexadecimal number F into binary, which gives 1111.

Practice this in the app

Syntax

HEX2BIN(number, [places])

Arguments in [square brackets] are optional.

number (required)
The hexadecimal number to convert, given as text or a number. Up to 10 digits.
places (optional)
Minimum number of characters in the result; pads with leading zeros.

Returns: The binary 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
=HEX2BIN("FF") 11111111 Typical
=HEX2BIN("FFFFFFFFFF") 1111111111 Negative (two's complement)
=HEX2BIN(0) 0 Zero
=HEX2BIN("") 0 Empty string
=HEX2BIN({"1","10"}) 1 Spill
=HEX2BIN(11) 10001 Number input (not text)
=HEX2BIN("G1") #NUM! Invalid digit
=HEX2BIN("1FFFFFFFFFF") #NUM! Too long input

Watch out for

  • Input is limited to 10 characters.
  • Result is text, not a number.

Where it works

Excel
HEX2BIN 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 .