Hex to binary

Expand hex values into bits to read flags, masks and register fields.

Tier 0 · browser · unlimited
5 characters
Binary
0001 1111 0100
Binary111110100
Octal764
Decimal500
Hexadecimal1F4
Bits9

From digits to bits

Each hexadecimal digit is exactly four bits, so converting hex to binary is a lookup: write the four-bit pattern of every digit in order. A is 1010, F is 1111, 3 is 0011. Grouping the output in nibbles keeps each digit's bits together, which makes it easy to read register maps, bit flags, IPv6 address pieces and protocol headers where each bit has a meaning.

Worked example

0x1F4 → 1 = 0001, F = 1111, 4 = 0100 → 0001 1111 0100 (500 in decimal). In a status register, this tells you at a glance which flags are set: bits 2, 4, 5, 6, 7 and 8, counting from 0 on the right.

Leading zeros

With grouping on, the first nibble keeps its leading zeros so groups align with hex digits. Turn grouping off for the shortest binary form.

How this works

The page reads the hex digits into an exact big integer and writes it in base 2. With grouping, the bits are padded on the left to a multiple of four and split into nibbles, so each group matches one hex digit of the input. Case does not matter, and 0x, spaces and underscores are ignored. The table repeats the value in decimal and octal and gives its length in bits. Each line converts separately.

Frequently asked

How do I convert hex to binary by hand?

Replace each hex digit with its four-bit pattern: 0 = 0000, 5 = 0101, A = 1010, F = 1111.

Why are there leading zeros?

So each group of four bits lines up with one hex digit. Turn off grouping for the shortest form.

How long can the input be?

As long as you like; the conversion is exact.

Does it convert hex text to characters?

No. For bytes of text, use the hex to text page.

Sources

Reviewed Oct 17, 2026 · test vectors fixtures/dev/hex-to-binary/