Base 16 → base 2
Hex to Binary Converter
Expand hexadecimal into bits. One digit in, four bits out — no arithmetic required.
—
—
How to convert hex to binary
This is the easiest conversion in the set, because it needs no division and no multiplication. Replace each hex digit with its four-bit pattern and join the results in order. That is the whole method.
- Take the leftmost hex digit.
- Write its four-bit pattern, including any leading zeros.
- Move right and do the same for every remaining digit.
- Concatenate the groups in the order you produced them. No reversing, no carrying.
The shortcut, and why it exists
Sixteen is 24. That single fact makes hex and binary interchangeable at the digit level: each hex digit covers exactly four bit positions and the groups never interfere. Base 10 has no such relationship with base 2, which is why converting decimal to binary needs real arithmetic and this does not.
You do not need to learn 256 byte values. Learn the sixteen nibble patterns below and you can expand any hex string of any length at reading speed.
| Hex | Decimal | Binary | Octal |
|---|---|---|---|
| 0 | 0 | 0000 | 0 |
| 1 | 1 | 0001 | 1 |
| 2 | 2 | 0010 | 2 |
| 3 | 3 | 0011 | 3 |
| 4 | 4 | 0100 | 4 |
| 5 | 5 | 0101 | 5 |
| 6 | 6 | 0110 | 6 |
| 7 | 7 | 0111 | 7 |
| 8 | 8 | 1000 | 10 |
| 9 | 9 | 1001 | 11 |
| A | 10 | 1010 | 12 |
| B | 11 | 1011 | 13 |
| C | 12 | 1100 | 14 |
| D | 13 | 1101 | 15 |
| E | 14 | 1110 | 16 |
| F | 15 | 1111 | 17 |
Worked examples
C0DE C → 1100 0 → 0000 D → 1101 E → 1110 joined → 1100 0000 1101 1110 3F 3 → 0011 F → 1111 joined → 0011 1111 A9 A → 1010 9 → 1001 joined → 1010 1001
Leading zeros are not optional
This is where hand conversions go wrong. Inside a multi-digit number every hex digit must contribute four bits, even when its pattern begins with zeros. Dropping them shifts everything to the right and produces a different number.
correct C0DE → 1100 0000 1101 1110 (16 bits) wrong C0DE → 1100 0 1101 1110 (13 bits, wrong value)
The only zero that can legitimately disappear is at the very front of the whole number, where it changes nothing — the same way 007 and 7 are equal in decimal.
Grouping, and reading bits like an engineer
An unbroken run of bits is technically correct and practically unreadable. The chips switch between two conventions that answer different questions.
- Nibbles — groups of four, aligned with the hex digits. Use this to check a conversion or trace a hex digit into the bit pattern.
- Bytes — groups of eight, aligned with memory. Use this when you care about storage, protocol fields or how a value sits in registers.
- Unbroken — no separators, for pasting into code or a field that rejects spaces.
Bit widths worth recognising
| Hex digits | Bits | Typically |
|---|---|---|
| 1 | 4 | A nibble — one mask, one flag group |
| 2 | 8 | One byte — a character, a color channel |
| 4 | 16 | A word — a port number, a UTF-16 code unit |
| 6 | 24 | An RGB color |
| 8 | 32 | An IPv4 address, a 32-bit register |
| 16 | 64 | A 64-bit integer or pointer |
| 32 | 128 | A UUID, an AES key, an IPv6 address |
| 64 | 256 | A SHA-256 hash |
Counting hex characters is the fastest way to identify what you are looking at. Thirty-two characters is almost certainly a UUID or an MD5 digest; sixty-four is almost certainly SHA-256.
To practise the substitution without a tool, see converting hex to binary by hand. For why both notations exist at all, see hex versus binary, and for every byte written out, the hex to binary table.
Frequently asked questions
How do I convert hex to binary quickly?
Replace each hex digit with its four-bit pattern and join them in order. No arithmetic is needed because 16 is 2 to the power of 4.
What is F in binary?
1111. F is 15 in decimal, which sets all four bits of a nibble.
What is C0DE in binary?
1100 0000 1101 1110. C is 1100, 0 is 0000, D is 1101 and E is 1110.
Why must I keep the leading zeros?
Each hex digit occupies four bit positions. Dropping a zero shifts every bit to its right and changes the value. Only zeros at the very front of the number are free to omit.
How many bits is one hex digit?
Exactly four, which is called a nibble. Two hex digits make one eight-bit byte.
Should I group bits in fours or eights?
Fours line up with the hex digits and make a conversion easy to verify. Eights line up with bytes and make memory layout easier to read.