To convert hexadecimal to binary, replace each hex digit with its four-bit binary equivalent and join the groups together.
Hexadecimal (base 16) uses the digits 0 to 9 and the letters A to F. Because 16 is exactly 2 to the power of 4, every hex digit maps to exactly four binary digits, which makes this one of the easiest conversions to do by hand.
Hex to Binary Converter
Type a hex value (with or without a 0x or # prefix) to see it in binary.
The Hex to Binary Table
Memorize this table and the rest is just looking things up.
| Hex | Decimal | Binary |
|---|---|---|
| 0 | 0 | 0000 |
| 1 | 1 | 0001 |
| 2 | 2 | 0010 |
| 3 | 3 | 0011 |
| 4 | 4 | 0100 |
| 5 | 5 | 0101 |
| 6 | 6 | 0110 |
| 7 | 7 | 0111 |
| 8 | 8 | 1000 |
| 9 | 9 | 1001 |
| A | 10 | 1010 |
| B | 11 | 1011 |
| C | 12 | 1100 |
| D | 13 | 1101 |
| E | 14 | 1110 |
| F | 15 | 1111 |
How to Convert Hex to Binary Step by Step
- Write out the hex number one digit at a time.
- Replace each digit with its 4-bit group from the table.
- Join the groups. You can drop leading zeros at the very start of the result, but never inside it.
Worked Examples
| Hex | Digit by digit | Binary |
|---|---|---|
| 2F | 2 = 0010, F = 1111 | 0010 1111 (101111 without leading zeros) |
| B4 | B = 1011, 4 = 0100 | 1011 0100 |
| 3A7 | 3 = 0011, A = 1010, 7 = 0111 | 0011 1010 0111 (1110100111 without leading zeros) |
| FF | F = 1111, F = 1111 | 1111 1111 |
As a check, 2F is 47 in decimal, and 101111 is 32 + 8 + 4 + 2 + 1 = 47.
A Longer Example: a Web Color
The color #FF8800 is three bytes: red FF, green 88 and blue 00. In binary that is 1111 1111 1000 1000 0000 0000, which is 24 bits in total. See hexadecimal explained for more on color codes.
The Alternative: Go Through Decimal
You can convert hex to decimal first and then decimal to binary, but it takes more steps. 2F = 2 × 16 + 15 = 47, and 47 in binary is 101111. The direct table method gives the same answer faster.
Common Mistakes
- Dropping zeros inside a group. The hex digit 2 is
0010, not10. Keep all four bits for each digit. - Mixing up letters. A is 10 (
1010) and B is 11 (1011). Upper and lower case mean the same thing. - Converting the 0x prefix. The 0x only tells you the number is hex. It is not part of the value.
Where You Will See Hex Converted to Binary
Programmers and network engineers do this constantly. MAC addresses and IPv6 addresses are written in hex, memory addresses in debuggers are shown in hex, and color codes in web design are hex. Seeing the bits behind the digits helps when you work with flags, masks and permissions.
Frequently Asked Questions
What is 0xFF in binary?
11111111, eight bits all set to 1. In decimal that is 255.
What is hex A in binary?
A is 10 in decimal, which is 1010 in binary.
How do I convert binary back to hex?
Group the bits in fours from the right and replace each group with its hex digit. Our guide to binary to hexadecimal shows how.