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.

HEX2BIN is valuable when the compactness of hexadecimal stops being helpful and the actual bit layout needs to be visible. By expanding the value into binary text, the workbook can expose masks, flags, or register-style patterns that are much harder to inspect in hex form alone.

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.

It is a good beginner example because one hex digit maps neatly to one small bit group. That makes it easy to see how HEX2BIN turns a short code into a bit pattern you can inspect more closely.

=HEX2BIN("F") // Returns "1111"
Check Answer
Challenge #1
Target: Sheet1!D1

Convert Hex "F" to binary.

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.

This matters because some systems care about the shape of the output as much as the value itself. The example shows how HEX2BIN can prepare data for an 8-bit display without changing the meaning of the number.

=HEX2BIN("A", 8) // Returns "00001010"
Check Answer
Challenge #2
Target: Sheet1!D2

Convert Hex "A" to a padded 8-bit binary string.

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.

This is one of the most important examples in the lesson because the result can look strange if you expect normal positive conversion. It teaches that some long hex inputs carry sign meaning, not just magnitude.

=HEX2BIN("FFFFFFFFFF") // Returns "1111111111"
Check Answer
Challenge #3
Target: Sheet1!D3

Convert -1 (Hex FFFFFFFFFF) to 10-bit binary.

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.

So the example is really showing why someone would convert the value at all. The hex form is shorter, but the binary form makes the bit layout visible right away.

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

Convert Hex "1C" to a 10-bit binary mask.

Conclusion Recap

HEX2BIN is most useful when a compact hexadecimal code needs to be opened up into a visible bit pattern. In this lesson, that mattered because the binary result makes masks, flags, and register-style values much easier to inspect than the shorter hex form does.

That is why HEX2BIN is usually about readability, not arithmetic. The result comes back as text, and the optional places argument helps shape positive values into a fixed-width binary field when the layout of the bits matters as much as the value itself.

  • 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
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.