How to Convert Hexadecimal to Binary in Excel

Hexadecimal numbers are in base 16 and are often used by computer programmers. Sometimes, you may need to convert hexadecimal numbers to binary in Excel. You can easily do so using the HEX2BIN function.

In this tutorial, we will learn how to perform Hexadecimal to binary conversion using the HEX2BIN function.

What are Hexadecimal Numbers?

We usually deal with decimal numbers that are in base 10. They start from 0 and end with 9:

0, 1, 2, 3, 4, 5, 6, 7, 8, 9

A hexadecimal number is in base 16. They can also be referred to as hex or hex numbers. These numbers start from 0 and end with 15:

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15

Since writing numbers with two digits (10, 11) can cause confusion with other numbers (112 à is it “1 and 12”, “11 and 2”, or “1 and 1 and 2”?), the hexadecimal numbers starting from 10 are represented with English capital letters: 10=A, 11=B, 12=C, 13=D, 14=E, and 15=F.

Therefore, the hexadecimal numbers are as follows:

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F

Examples of hexadecimal numbers: 12A, AB45C, FFF, 908D

What are Binary Numbers?

Binary numbers are in base 2, therefore there are only two binary numbers: 0 and 1. Binary numbers are also often used by programmers and computer engineers, but there are many applications for them also in cryptography, digital encoding, or mathematics fields.

Examples of binary numbers: 100011101, 111, 1001, 10000

Convert from Hexadecimal to Binary Using HEX2BIN

Now that we know what hexadecimal and binary numbers are, we will learn how to convert the former to the latter using the HEX2BIN function in Excel.

The HEX2BIN function accepts two arguments: a hexadecimal number, and an optional argument called places that determines how many binary digits to produce.

=HEX2BIN(hexadecimal_number, places)

You can use this function for cells that contain hexadecimal values:

HEX2BIN function used with a single cell

If you want to apply the function to other cells, you can click on the small rectangle on the lower right of the cell with the HEX2BIN function, and drag in the desired direction:

Apply HEX2BIN to other cells by dragging

This way, you can easily convert all of your hexadecimal numbers into binary.

HEX2BIN function applied to multiple cells

You can also use the HEX2BIN function to convert a value that’s not present in any cell. But you first need to enclose the hexadecimal number with quotation marks:

HEX2BIN function used with a value

The second argument of the HEX2BIN function (places) that we omitted, is used for padding the binary outcome with zeros, such that all binary numbers you obtain have the same length.

Let’s say we want all of our binary numbers to have 9 digits. Then, we provide the second argument as 9:

=HEX2BIN(A3, 9)
HEX2BIN output padded with zeros

This way, we standardized the binary numbers such that each of them has the same length.

In this tutorial, we learned what hexadecimal and binary numbers are, and how to convert a hex number into binary with a very useful function in Excel: HEX2BIN. Nice work!

Other numbers (decimals included) that you can convert in Excel include the following:

Leave a Comment