Guide
Hex vs Binary
Hex is binary, compressed four bits at a time and made readable.
They are the same information
Unlike hex and decimal, which represent values differently, hex and binary represent the same bits in the same order. Hex is purely a compression of binary for human eyes.
1100 0000 1101 1110 binary — 16 characters C 0 D E hex — 4 characters identical bits, one quarter the width
Because the mapping is digit-by-digit with no arithmetic, converting between them is mechanical in both directions. Nothing is lost and nothing is approximated.
Side by side
| Binary | Hexadecimal | |
|---|---|---|
| Base | 2 | 16 |
| Symbols | 0, 1 | 0–9, A–F |
| Bits per character | 1 | 4 |
| One byte | 8 characters | 2 characters |
| A 32-bit value | 32 characters | 8 characters |
| A SHA-256 hash | 256 characters | 64 characters |
| Individual bits | Directly visible | One step away |
| Error-prone to read | Very | Much less so |
When you genuinely need binary
Hex hides individual bits behind a digit. Usually that is a feature. Sometimes it is not.
- Explaining a bitwise operation. AND, OR, XOR and shifts are much clearer when the operands are lined up bit by bit.
- Single-bit flags. When a register packs eight independent booleans, the binary view shows all eight at once.
- Teaching. Two's complement, sign bits and overflow only make sense when the bits are visible.
- Hardware interfaces. Datasheets describe registers bit by bit, and matching the datasheet layout prevents mistakes.
masking, shown in binary
value 1010 1101
mask 0000 1111 (0F)
AND ---------
0000 1101 → only the low nibble survives
the same operation in hex
AD & 0F = 0D
The hex line is shorter and the binary lines are clearer. For a one-line comment in code, use hex. For an explanation, use binary.
Why four bits, exactly
Sixteen is 24, so one hex digit covers exactly four bit positions with no overlap and no remainder. That is the property everything else depends on.
| Hex digits | Bits | Common name |
|---|---|---|
| 1 | 4 | Nibble |
| 2 | 8 | Byte |
| 4 | 16 | Word |
| 8 | 32 | Doubleword |
| 16 | 64 | Quadword |
Every one of those is a whole number of hex digits. That is not true of any other readable base, which is why hex is the standard for writing binary data and always has been.
Reading hex as bits without converting
Once the sixteen patterns are learned, you can read the bits straight out of a hex digit. These four cover most practical cases.
| Hex digit | Bits | Recognise it as |
|---|---|---|
| 8 | 1000 | Only the top bit of the nibble |
| F | 1111 | All four bits |
| 0 | 0000 | No bits |
| 7 | 0111 | All but the top bit |
| 1 | 0001 | Only the bottom bit |
When you see 80, think \u201ctop bit of the byte\u201d rather than \u201cone hundred and twenty-eight\u201d. When you see 7F, think \u201ceverything but the top bit\u201d. Reading hex as bit patterns rather than quantities is the point at which hex starts saving you time.
Converting
Both directions are mechanical. Expand each digit to four bits, or group bits into fours from the right. The hex to binary converter and binary to hex converter handle any length, and the reference table lists every byte.
Frequently asked questions
What is the difference between hex and binary?
They represent the same bits. Hex packs four bits into each character, so it is a quarter the length and much easier to read without losing any information.
Is hex just shorthand for binary?
Effectively yes. Each hex digit is exactly four bits, so conversion is a direct substitution with no arithmetic.
Why not just use binary?
Length and error rate. A 32-bit value is 32 binary characters or 8 hex characters, and miscounting a long run of ones is very easy.
When should I use binary instead?
When individual bits matter: explaining bitwise operations, reading single-bit flags, or matching a hardware datasheet.
How many bits is one hex digit?
Exactly four, called a nibble. Two hex digits make one byte.
Does converting hex to binary lose anything?
No. The conversion is exact in both directions, because the mapping is one digit to four bits.