Practice free

BIN2HEX function

BIN2HEX converts a binary number to hexadecimal. It is seen in IT, networking and low-level data work, and the input is limited to 10 characters.

Example

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

Practice this in the app

Syntax

BIN2HEX(number, [places])

Arguments in [square brackets] are optional.

number (required)
The binary 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 hexadecimal 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
=BIN2HEX("1101") D Typical
=BIN2HEX("1111111111") FFFFFFFFFF Negative (two's complement)
=BIN2HEX(0) 0 Zero
=BIN2HEX("") 0 Empty string
=BIN2HEX({"1","10"}) 1 Spill
=BIN2HEX(1101) D Number input (not text)
=BIN2HEX("102") #NUM! Invalid digit
=BIN2HEX("11111111111") #NUM! Too long input

Watch out for

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

Where it works

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