Hex to Binary Converter

Share converter:
Embed this tool:

Type a hexadecimal number and its binary form appears as you type. The guide below shows the simple digit-by-digit swap that does the same job on paper.

How hex maps to binary

Hexadecimal has sixteen digits (0 to 9, then a to f), and sixteen is 24. That means every hex digit corresponds to exactly four binary digits, and the conversion is a plain substitution with no arithmetic at all. This is the reason hex is the favourite shorthand for binary data such as bytes, bit masks and memory addresses.

How to convert hex to binary

  1. Write the hex number one digit at a time.
  2. Replace each digit with its four-bit group from the table below.
  3. Join the groups in the same order.
  4. Remove any zeros at the very start of the result.

Example: convert a5. The digit a is 1010 and 5 is 0101, so joined together they read 10100101, which is 165 in decimal.

Example with leading zeros: convert 2f3. The digits give 0010, 1111 and 0011. Joined that is 001011110011, and dropping the two leading zeros leaves 1011110011, which is 755 in decimal. The converter also drops leading zeros, so 1f shows as 11111 rather than 00011111.

What the converter accepts

  • Digits 0 to 9 and letters a to f, in upper or lower case. FF and ff give the same result.
  • No prefix, sign or point. An empty box, a 0x prefix, a minus sign, a dot or any other letter makes the answer box show NaN. Note that e is a valid hex digit, so 1e3 is read as the hex number 1e3 (483), not as scientific notation.
  • Up to 13 hex digits exactly. The input is stored as a double-precision number with 53 significant bits, so values of 13 digits or fewer are always exact. Longer values are exact only if they fit in 53 bits, otherwise the low bits are rounded away.

Hexadecimal to binary conversion table

Each hex digit as four bits
HexBinaryDecimal
000000
100011
200102
300113
401004
501015
601106
701117
810008
910019
a101010
b101111
c110012
d110113
e111014
f111115
Longer values, as the converter prints them
HexBinaryDecimal
1f1111131
3c11110060
7e1111110126
a510100101165
d611010110214
ff11111111255
100100000000256
be31011111000113043
ffff111111111111111165535

Use the binary to hex converter to regroup bits into hex digits, or the hex to decimal converter when you need an ordinary number. For arithmetic on hex values, there is the hexadecimal calculator.

Frequently asked questions

How do I convert hex ff to binary?

Each f is 1111, so ff becomes 1111 1111, written 11111111 without the space. That is 255 in decimal.

Why do some results have fewer bits than four times the digit count?

The converter removes leading zeros. The hex number 1f has two digits, but the first digit is 0001, so the result is 11111 rather than 00011111.

Can I type a 0x prefix?

No. A leading 0x makes the answer box show NaN because x is not a hex digit. Enter only the digits, for example ff instead of 0xff.

Does the case of the letters matter?

No. A to F and a to f are the same digits, so DEADBEEF and deadbeef give identical binary output.

References

  1. Donald E. Knuth, The Art of Computer Programming, Volume 2: Seminumerical Algorithms, section 4.1 (Positional Number Systems)

Cite this converter and page

If you use this page in your work, you can cite it as:

Reeliy Editorial Team. (2026). Hex to Binary Converter. Reeliy. https://reeliy.com/converters/convert-hex-to-binary“Hex to Binary Converter.” Reeliy, 2026, https://reeliy.com/converters/convert-hex-to-binary.