Hex to binary converter

To convert hex to binary, replace each hex digit with its 4-bit group: 0 is 0000, 9 is 1001 and F is 1111. So FF becomes 11111111. The converter below gives the exact binary value of any hex number, however long, and it runs in your browser.

Input number

Enter a whole number and choose the bases.

Enter a whole number, choose the bases, then convert.

Allowed digits depend on your input base.

Swap uses the result as your next input when one is available.

Whole numbers only. Enter digits without prefixes or separators: FF, not 0xFF. Surrounding whitespace is ignored.

Converted number

The same integer in your chosen base.

Exact whole-number conversion

Hex to binary conversion table

The middle column is the converter's output. The right column pads it with zeros to four bits.
Hex digitConverter result4-bit group
000000
110001
2100010
3110011
41000100
51010101
61100110
71110111
810001000
910011001
A10101010
B10111011
C11001100
D11011101
E11101110
F11111111

Use the right column when you convert by hand. Every hex digit needs exactly four bits, and a digit below 8 needs its leading zeros inside a longer number. The converter drops zeros only at the very front of its result.

The digits 8 to F all start with a 1 bit, because their values, 8 to 15, need the 8 place. The digits 0 to 7 all start with a 0 in their 4-bit group, which is why their converter result is shorter.

How to convert hex to binary

The shortcut works because 16 is 2 to the power 4. Each hex digit stands for one group of four bits, sometimes called a nibble, and the groups never overlap. You can convert each digit on its own and join the groups in the same order.

Take 1A3 as a worked example. The digit 1 is 0001, A is 1010 and 3 is 0011. Joined, that is 000110100011. The three leading zeros carry no value, so the number is 110100011, which is what the converter returns.

Two hex digits always make one byte. FF is 11111111, and 80 is 10000000. A longer value such as DEADBEEF is eight digits, so it gives 32 bits: 11011110101011011011111011101111. The converter reaches the same bits through the exact value of the number, not digit by digit, so both routes agree.

Using the hex to binary converter

The page opens with Hexadecimal (16) in From base and Binary (2) in To base. Paste the hex number in the Number field and select Convert number. The bits appear in the Converted number panel, ready for Copy result or Download TXT.

The result starts at the first 1 bit. 7F gives 1111111, seven bits, and 0F gives 1111. If you need whole bytes, add zeros on the left until the length is a multiple of 8, so 7F becomes 01111111. The same rule gives a multiple of 4 for whole hex digits.

Hex letters can be upper or lower case. Remove any 0x prefix first, because the converter rejects the x of 0x1F as a digit that is not valid in hexadecimal. Swap bases moves the bits into the Number field and turns the form into binary to hex, so you can convert back. Reset returns to hex to binary.

Limits

The converter takes one whole number. A space inside the input, as in FF FF, is rejected, so paste a long value as one run of digits: C0FFEE gives 110000001111111111101110. A hex fraction such as 1A.8 is rejected rather than rounded.

It does not read a hex dump or write a binary file. A tool that turns hex text into file bytes does a different job. This page turns one hex number into its bits and shows them as text you can copy.

A minus sign is kept on the result and is not turned into two's complement bits. There is no digit limit, so a 128-bit key or hash value written in hex converts to its full bit string exactly. Browser memory is the only practical limit, and Cancel stops a conversion that runs long.

Questions

How do you convert hex to binary?

Write each hex digit as four bits, using the table on this page, and join the groups in order. For 2F, 2 is 0010 and F is 1111, so 2F is 00101111. Drop the leading zeros for the plain number, 101111, which is what this converter shows.

What is hex 7 in binary?

Hex 7 is 111 in binary, which is the same value as decimal 7. As a 4-bit group it is written 0111, with one leading zero. Inside a longer hex number, such as 7F, the zero matters in the middle but not at the front, so 7F is 1111111.

How many bits is one hex digit?

One hex digit is exactly four bits, because 16 is 2 to the power 4. Two hex digits make an 8-bit byte and four make 16 bits. That fixed width is why programmers write bytes in hex: FF is easier to read than 11111111.

Why does the converter drop my leading zeros?

It returns the value of the number, and leading zeros do not change a value, so 0F gives 1111 and 00FF gives 11111111. When a register, mask or byte needs a fixed width, pad the result on the left with zeros until it has the number of bits you need.