HEX2BIN Function

HEX2BIN Function

HEX2BIN Function

Convert hexadecimal values to binary text in Excel. Useful when you want to inspect bits behind a hex code or register value.

ExcelClash Team
PUBLISHED

Summary

HEX2BIN converts hexadecimal text into binary text. It is useful when a value is easier to store or read in hex, but you want to see the actual bit pattern behind it.

This is common in technical sheets because hex is compact, while binary makes individual bits visible. If you are checking flags, masks, or small register values, HEX2BIN helps you move from the compact form to the detailed form quickly.

Purpose

Convert hex to binary

Turns a base-16 value into base-2 text.

Return value

Binary text

Returns a string made of 1 and 0.

Syntax

=HEX2BIN(number, [places])

number is the hex value to convert. places is optional and pads positive results with leading zeros.

The formula takes a hexadecimal input and expands it into binary text. Use places when the output has to match a fixed-width bit field. If you leave it out, Excel returns the natural binary length of the positive value.

Arguments

  • number - [required] The hexadecimal value to convert. Excel accepts up to 10 characters.
  • [places] - [optional] The minimum number of binary characters to return for positive values.

number should be a valid hex value using digits 0-9 and letters A-F. places is optional and only applies to positive results. If the binary result is longer than the places value, Excel returns #NUM!. Signed negative values use Excel's fixed engineering-format behavior instead of ordinary padding.

HEX2BIN vs similar functions

HEX2BIN is useful when the final goal is to inspect bits, not just convert between number systems:

Function What it does Typical use Result
HEX2BIN Converts hex to binary Flags, masks, and bit inspection Binary text
HEX2DEC Converts hex to decimal Get a number you can use in math Number
HEX2OCT Converts hex to octal Move into a legacy base-8 format Octal text
BIN2DEC Converts binary to decimal Turn bits back into a number Number

Using HEX2BIN

The simplest use is taking a short hex value like F or 1C and expanding it into binary so the bit pattern is easy to read. A value that looks compact in hex can become much clearer once you see every digit as a 1 or 0.

The optional places argument helps when you want the output to line up with a fixed bit width. For example, A becomes 1010 by default, but with 8 places it becomes 00001010. If the converted result is longer than the places value, Excel returns #NUM!.

There is one important limit here. Even though HEX2BIN accepts hex input up to 10 characters, the output range is still limited to values that fit the function's signed binary rules. Negative values return signed 10-bit results, and larger positive values outside the supported range return #NUM!.

Example 1 - Convert F to binary

This example shows the direct relationship between a single hex digit and a 4-bit binary pattern. The value F becomes 1111, which is useful whenever you want to expand a compact hex value into the individual bits it represents.

=HEX2BIN("F") // Returns "1111"
Check Answer
Challenge #1
Target: Sheet1!F1
Basic Hex to Binary

Convert Hex "F" to binary. Formula: =HEX2BIN("F").

Example 2 - Pad the output to 8 bits

The places argument is important when the binary output has to match a fixed-width field such as a byte. Without padding, A would become 1010. With 8 places, Excel returns 00001010, which keeps the value the same while preserving the expected field width.

=HEX2BIN("A", 8) // Returns "00001010"
Check Answer
Challenge #2
Target: Sheet1!F2
8-Bit Register Padded

Convert Hex "A" to a padded 8-bit binary string. Formula: =HEX2BIN("A", 8).

Example 3 - Convert a negative hex value

This example shows how signed values are handled in Excel's engineering conversion functions. The 10-character hex input represents -1, so HEX2BIN returns the signed 10-bit binary form 1111111111. That behavior is important if your source data uses signed fixed-width values rather than plain positive codes.

=HEX2BIN("FFFFFFFFFF") // Returns "1111111111"
Check Answer
Challenge #3
Target: Sheet1!F3
Signed Negative Hex

Convert -1 (Hex FFFFFFFFFF) to 10-bit binary. Formula: =HEX2BIN("FFFFFFFFFF").

Example 4 - Read a wider mask

The hex value 1C is short and compact, but the binary version 0000011100 makes the active bit positions much easier to inspect. This is the kind of conversion that helps when you are checking masks, status fields, or small register values.

=HEX2BIN("1C", 10) // Returns "0000011100"
Check Answer
Challenge #4
Target: Sheet1!F4
Memory Address Decode

Convert Hex "1C" to a 10-bit binary mask. Formula: =HEX2BIN("1C", 10).

Quick recap

  • Converts hex to binary: HEX2BIN returns base-2 text from a base-16 value.
  • Places pads positive values: Use it when your bit pattern should have a fixed width.
  • Signed output has limits: Large unsupported values return #NUM!.
  • Returns text: The result is for display and bit reading, not direct arithmetic.
  • Useful for masks and flags: It helps when the bits matter more than the compact hex form.
Tactical Arena
Select Scenario:
Share HEX2BIN Function!

Tell your friends about this post

Discussion

ExcelClash is an interactive platform designed to level up your Excel skills through real-world exercises and challenges. Sharpen your logic, solve real spreadsheet problems, and learn faster.

© 2026 ExcelClash, Inc. All rights reserved.