Hex to binary converter
Convert hex numbers to binary — every hex digit becomes 4 bits. Exact at any size, with a worked example and a table of common values. Free, and computed in your browser.
Part of developer tools.
Binary
10101101
Octal
255
Decimal
173
Hexadecimal
AD
Hex to binary table
| Decimal | Hex | Binary |
|---|---|---|
| 0 | 0 | 0 |
| 1 | 1 | 1 |
| 2 | 2 | 10 |
| 3 | 3 | 11 |
| 4 | 4 | 100 |
| 5 | 5 | 101 |
| 6 | 6 | 110 |
| 7 | 7 | 111 |
| 8 | 8 | 1000 |
| 9 | 9 | 1001 |
| 10 | A | 1010 |
| 11 | B | 1011 |
| 12 | C | 1100 |
| 13 | D | 1101 |
| 14 | E | 1110 |
| 15 | F | 1111 |
| 16 | 10 | 10000 |
| 100 | 64 | 1100100 |
| 127 | 7F | 1111111 |
| 255 | FF | 11111111 |
| 256 | 100 | 100000000 |
| 1000 | 3E8 | 1111101000 |
| 1024 | 400 | 10000000000 |
| 4096 | 1000 | 1000000000000 |
| 65535 | FFFF | 1111111111111111 |
| 4294967295 | FFFFFFFF | 11111111111111111111111111111111 |
| 18446744073709551615 | FFFFFFFFFFFFFFFF | 1111111111111111111111111111111111111111111111111111111111111111 |
The last rows are the largest 32-bit and 64-bit unsigned values. The second is past the point where ordinary JavaScript numbers start rounding; the table and the converter above both compute with BigInt, so every digit is exact.
How to convert hex to binary
Replace each hex digit with its 4-bit binary value, keeping the leading zeros inside each group — hex 1 is 0001, not 1 — and join the groups in order. For AD: A → 1010, D → 1101, giving 1010 1101. Nothing is carried from one digit to the next, so a long hex number converts as easily as a short one.
Hex and binary side by side
The largest 16-bit value is FFFF in hex and 1111111111111111 in binary: 4 digits against 16. Every hex digit is exactly 4 bits, so the lengths stay in a fixed ratio and any stretch of digits can be converted without looking at its neighbours. Binary is what bit masks, flags and subnet masks are reasoned in: a /24 network mask is twenty-four 1 bits followed by eight 0 bits, 255.255.255.0 once written in decimal. In JavaScript and Python source, 173 is written 0xAD in hex and 0b10101101 in binary. Paste a prefixed number into the converter and it switches to the matching base; a number with no prefix is read in the selected base — hex on this page.
Other conversions
Going the other way? Binary to hex converter.
Or open the full number base converter and see a number in all four bases at once.