Hex to Binary Converter

Convert hexadecimal (base 16) numbers to binary.

Hex
Binary
Runs locally in your browser

About the Hex to Binary Converter

Each hex digit maps to exactly four binary bits, so hex is the usual shorthand for binary data. This tool expands hex to binary with arbitrary precision, one number per line, accepting an optional 0x prefix and ignoring case.

To reverse, use Binary to Hex; to see all bases, the All Base Converter.

Expansion is a lookup rather than a calculation: 0 is 0000, 5 is 0101, A is 1010, F is 1111. Knowing the sixteen nibbles is what lets people read a flags byte at sight, since A5 is 1010 0101 and you can point straight at which bits are set. Protocol work leans on this constantly, from a TCP flags field to an interrupt mask to the mode bits in a file header.

The one surprise is that the result carries no leading zeros. Converting 0F gives 1111, four bits, not 00001111, because a number does not carry a width of its own. When you are lining bits up against a diagram of an 8-, 16- or 32-bit field, pad the answer on the left yourself before comparing. To set, clear or test particular bits, the Bitwise Calculator applies AND, OR and XOR masks.

How to use

  1. Paste hex numbers, with or without 0x.
  2. Copy the binary results.

Common questions

Does each hex digit become four bits?
Yes, so FF becomes 11111111.
Is the 0x prefix accepted?
Yes, and it is optional.
Case-sensitive?
No.