Hex to Binary
Convert hexadecimal numbers to binary and back.
Hex to Binary Converter
Expand hexadecimal values into their exact bit patterns. Paste one hex number per line – with or without 0x – and get the binary result instantly: F → 1111, A5 → 10100101, 0x1F4 → 111110100. Switch direction to compress long binary numbers back into hex.
Converting hex to binary by hand
Replace each hex digit with its four-bit pattern and join the groups:
0= 0000,1= 0001,2= 0010,3= 00114= 0100,5= 0101,6= 0110,7= 01118= 1000,9= 1001,A= 1010,B= 1011C= 1100,D= 1101,E= 1110,F= 1111
So 3C is 0011 1100. Leading zeros of the first group can be dropped, giving 111100.
Why developers convert hex to binary
Hex is compact, but individual bits are hard to see in it. When you read a hardware register like 0x8C, a TCP flags byte, a file-permission mask, or a feature-flag bitmap, converting to binary (1000 1100) instantly shows which bits are set. It is also the fastest way to check that a mask such as 0xFFFFFF00 really covers the bits you expect.
Output options
- Pad to full bytes – always output 8, 16, 24… bits, so
Abecomes00001010. - Group digits – split bits into nibbles for readability:
1010 0101. - Prefix – output
0bliterals for Python, JavaScript, Java, or C++14.
The converter accepts upper- and lower-case digits, 0x, #, and trailing h notation (1Fh), plus fractional hex such as 0.8 (= 0.1 in binary). Because it uses big integers, 128-bit values like IPv6 groups or hashes convert without loss. For whole IPv6 addresses use IPv6 to Binary; for text, use String to Hex.
Frequently Asked Questions
How many binary digits does one hex digit have?
Four. Every hexadecimal digit maps to exactly one 4-bit group, from 0000 (0) to 1111 (F).
What is 0xFF in binary?
11111111 – eight ones, the maximum value of a single byte (255).
Can I keep leading zeros?
Yes. Turn on 'Pad to full bytes' and the binary output is padded to a multiple of 8 bits, so 0x0F becomes 00001111.