Home Tools Blog About

Hex to Binary and Binary to Hex Converter

Hex to binary conversion expands each hexadecimal digit into the four binary bits it represents, so the hex 2F becomes 0010 1111. Because one hex digit maps to exactly four bits, the two bases line up perfectly and the conversion is just a lookup, digit by digit. This guide shows how to convert hex to binary and binary to hex, the four-bit rule behind both, and a free converter for each direction.

The four-bit rule

Hexadecimal has 16 digits, 0 to 9 and A to F, and four binary bits also have 16 possible patterns, from 0000 to 1111. That is not a coincidence: one hex digit and one group of four bits carry the same amount of information. Hex F is binary 1111, hex 8 is binary 1000, and hex 0 is binary 0000. This is why hex is the standard shorthand for binary, since a long bit string becomes a quarter as many hex digits.

The same value sits behind both forms. For how hex, binary, decimal, and octal all relate, see our guide to number systems.

Convert hex to binary

To convert hex to binary, replace each hex digit with its four-bit pattern and join them in order. Hex 2F splits into 2 and F. The 2 is 0010 and the F is 1111, so 2F is 00101111. You never have to convert through decimal first, which is what makes the method so fast by hand.

For longer values the lookups add up, so the hex to binary converter expands the whole string instantly. It also accepts the spelled-out form through the hexadecimal to binary converter if that is how your input is labelled.

Convert binary to hex

Going the other way, you group the bits into fours starting from the right, then replace each group with its hex digit. The binary 10111010 splits into 1011 and 1010, which are B and A, so the result is BA. If the bit count is not a multiple of four, pad the left side with zeros first.

The binary to hex converter handles the grouping and padding for you, which removes the most common source of mistakes when the string is long.

A worked example

Take the binary 11110000. Group it into 1111 and 0000, which are F and 0, so the hex is F0. Read it back: F is 1111, 0 is 0000, giving 11110000 again. The round trip is exact because grouping bits never changes the underlying value, it only changes how it is written. If you also need the decimal value, run it through the binary to decimal converter.

Why programmers use both

Binary is how hardware actually stores data, but it is painful to read: a single byte is eight characters of 0 and 1. Hex compresses that to two characters while keeping a clean mapping to the bits, so memory addresses, color codes, and byte values are almost always shown in hex. Being able to expand hex back to binary lets you see the individual bits when you need to check a flag or a mask. For the character side of bytes, our hex to ASCII guide covers reading hex as text.

Free converters used in this guide

Frequently asked questions

How do I convert hex to binary?

Replace each hex digit with its four-bit binary pattern and join them in order. Hex 2F becomes 0010 1111. A hex to binary converter expands the whole string at once.

What is hex F in binary?

Hex F is 1111 in binary, the largest value a single hex digit can hold.

Why does one hex digit equal four bits?

Because four bits have 16 possible patterns and hex has 16 digits, so each hex digit maps cleanly to exactly one group of four bits.

How do I convert binary to hex when the length is not a multiple of four?

Pad the left side with zeros until the bit count is a multiple of four, then group the bits into fours and convert each group to a hex digit.

Is hex to binary lossless?

Yes. The value is identical in both bases, so you can convert back and forth without ever changing the number.

ATV

Written by Nick (ATV Team)

We build and maintain the 600+ free, client-side tools on this site, and every guide is written against the tools themselves: each figure is computed and checked before it is published, and every linked tool is tested in the browser. More about how we work on the about page, and the full library of guides lives on the blog.