Hexadecimal to Binary Converter
Convert hexadecimal numbers to binary format
Tip: Enter a hexadecimal number (0-9, A-F). The conversion happens in real-time.
Runs in your browserHex Binary
Hex to binary, step by step
Convert hex to binary
Type a hex number, with or without 0x, in capitals or lowercase, and its binary form appears as you type. Results longer than four digits are also split into groups of four bits, and the window bar shows the bit length.
Every hex digit is exactly four bits, so hex to binary needs no arithmetic on the whole number: each digit is swapped for its four bits. That is why the 8-digit DEADBEEF comes out as 32 bits.
How to convert hexadecimal to binary by hand
Write each hex digit as its four bits, from 0 = 0000 to F = 1111, and put the groups side by side. For 3A7F:
| Hex digit | Value | Four bits |
|---|---|---|
| 3 | 3 | 0011 |
| A | 10 | 1010 |
| 7 | 7 | 0111 |
| F | 15 | 1111 |
Together that is 0011 1010 0111 1111. Drop the two leading zeros and 3A7F is 11101001111111 in binary, 14 bits long. The step-by-step window above lists the bits of each digit you type.
Hex values in binary
| Hex | Binary | Bits |
|---|---|---|
| F | 1111 | 4 |
| 10 | 10000 | 5 |
| 1F | 11111 | 5 |
| 3F | 111111 | 6 |
| 55 | 1010101 | 7 |
| 7F | 1111111 | 7 |
| 80 | 10000000 | 8 |
| AA | 10101010 | 8 |
| FF | 11111111 | 8 |
| 100 | 100000000 | 9 |
| 7FFF | 111111111111111 | 15 |
| 8000 | 1000000000000000 | 16 |
| FFFF | 1111111111111111 | 16 |
80 is the top bit of a byte on its own, and 7F is every bit below it. AA and 55 alternate ones and zeros, 10101010 and 01010101 as full bytes, which is why they are common test patterns.
Have the bits and need hex?
The binary to hex converter groups bits in fours and writes each group as one hex digit.
Prefixes, spaces and leading zeros
Accepted
- A
0xprefix and lowercase letters:0xffgives11111111 - Spaces between bytes, so
DE AD BE EFconverts as one number - A minus sign:
-1Fgives-11111
Not done
- Leading zeros are not kept:
0Fgives1111, not00001111 - A minus sign is never turned into a two's complement bit pattern
- Hex fractions such as
0.8are not converted
For the decimal value of a hex number, use the hex to decimal converter; the number system converter shows all four bases together.
Hex to binary questions
11111111. F is 1111, so FF is two groups of four ones, eight bits in all.
16 is 2 to the power 4, so four bits have exactly sixteen patterns, one for each hex digit from 0 to F.
Leading zeros are left out: 0F gives 1111 and 1 gives 1. Add zeros on the left if you need full bytes.
Yes. Spaces are ignored, so the bytes convert as one number of any length. The step-by-step window shows the bits for up to 40 hex digits.
No. The conversion runs in your browser.