BIN2HEX Function

Excel 2007+

Summary

The BIN2HEX function converts binary numbers to their hexadecimal equivalents, supporting both positive and negative values through two's-complement representation. Ideal for bitwise operations and number system conversions in Excel.

Syntax

BIN2HEX(number, [places])

Parameters

Parameter Type Required Description
number String Yes Binary number to convert (max 10 characters/10 bits). Most significant bit is sign bit; remaining bits represent magnitude. Negative numbers use two's-complement.
places Integer No Number of characters in result. Omitting uses minimum required characters; useful for zero-padding.

Using the BIN2HEX Function

BIN2HEX is perfect for converting binary data from embedded systems, digital logic simulations, or cryptographic algorithms into readable hexadecimal format. Use it when working with hardware specifications, memory addresses, or binary file analysis.

Common BIN2HEX Examples

Convert Binary to Hex with Padding

=BIN2HEX("11111011", 4)

Converts binary 11111011 (251 decimal) to 4-character hex: 00FB

Simple Binary Conversion

=BIN2HEX("1110")

Converts binary 1110 (14 decimal) to minimal hex: E

Maximum Negative Binary

=BIN2HEX("1111111111")

Converts 10-bit negative binary to full 10-character hex: FFFFFFFFFF

Frequently Asked Questions

#NUM! error if number >10 characters or not valid binary.

Uses two's-complement notation. Negative results always return 10-character hex, ignoring places argument.

No - #NUM! error if result needs more characters than specified places.

Common Errors and Solutions

#NUM!

Cause: Invalid binary, >10 characters, places too small, or negative places

Solution: Verify binary format (0s/1s only), length ≤10, places ≥0 and sufficient

#VALUE!

Cause: Places argument is non-numeric

Solution: Ensure places is number or omit

Notes

  • Binary input as text/string recommended to preserve leading zeros
  • Negative binaries produce 10-character results regardless of places
  • Places truncates decimals (3.9 becomes 3)
  • Available in Excel 2007 and later

Compatibility

Available in: Excel 2007, Excel 2010, Excel 2013, Excel 2016, Excel 2019, Excel 2021, Microsoft 365

Not available in: Excel 2003 and earlier

Content last reviewed: December 9, 2025
Update frequency: As needed
Excel versions tested: Excel 2007+