Hex to Binary Converter
Paste a hex value to see its bits: each hex digit becomes exactly four binary digits, written side by side.
Hex uses only 0–9 and A–F
In binary (base 2)
10100111
Hex A7 is 1010 0111 in binary (base 2).
128 + 32 + 4 + 2 + 1 = 167
Tap a bit to flip it. Each tile is worth its digit × 2n.
How to convert hex to binary
Write each hex digit as its four-bit pattern and put the patterns side by side. Every digit gets all four bits, including leading zeros, so 3 is written 0011 and not 11.
For 3C9: 3 = 0011, C = 1100, 9 = 1001, so the bits are 0011 1100 1001. Zeros at the very front can then be dropped: 1111001001.
Bit masks are easier to see this way. 0x0F keeps the low four bits of a byte (0000 1111) and 0xF0 keeps the high four (1111 0000), which is why low-level code is written in hex.
1 hex digit = 4 bits; 8 = 1000, A = 1010, F = 1111
- Python, C and JavaScript all write hex literals with a 0x prefix and binary with 0b, so 0xF0 == 0b11110000. Source: Python reference, integer literals.
Common hex bytes in binary
Bytes that come up as masks, characters and markers, written out bit by bit.
| Hex | Binary | Common use |
|---|---|---|
| 00 | 0000 0000 | all bits off |
| 01 | 0000 0001 | lowest bit |
| 0F | 0000 1111 | low-nibble mask |
| 20 | 0010 0000 | ASCII space; the bit that changes letter case |
| 30 | 0011 0000 | ASCII digit 0 |
| 41 | 0100 0001 | ASCII A |
| 55 | 0101 0101 | alternating bits, a test pattern |
| 61 | 0110 0001 | ASCII a |
| 7F | 0111 1111 | largest signed byte; ASCII DEL |
| 80 | 1000 0000 | top bit; smallest signed byte (−128) |
Show all 15 rowsShow fewer
| AA | 1010 1010 | alternating bits, the other phase |
| C0 | 1100 0000 | two top bits |
| F0 | 1111 0000 | high-nibble mask |
| FE | 1111 1110 | all bits but the lowest |
| FF | 1111 1111 | all bits on; −1 as a signed byte |
Frequently Asked Questions
What is F in binary?
F is 15, which is 1111: all four bits of a nibble set. FF is 1111 1111.
Do I keep the leading zeros?
Inside the number, yes: every hex digit needs all four bits or the bits after it shift. At the very front they can be dropped because they do not change the value, though fixed-width fields (a byte, a register) keep them.
How many bits is a hex number?
Four per digit: 2 hex digits is 8 bits, 4 is 16 bits, 8 is 32 bits and 16 is 64 bits.