Binary vs Hexadecimal
The two number systems that power every computer — one verbose, one compact.
| Binary (base 2) | Hexadecimal (base 16) | |
|---|---|---|
| Digits | 0, 1 | 0–9, A–F |
| 1 byte | 8 digits (e.g. 10110010) | 2 digits (e.g. B2) |
| Used in | Hardware, bit-level logic | Memory addresses, colors |
- Matches actual transistor state
- Trivial bitwise operations
- 4× more compact than binary
- Direct conversion (4 bits = 1 hex digit)
When to use which
Use binary when reasoning about bit-level operations and hardware.
Use hex for human-readable memory dumps, color codes (#FF6B35), and crypto hashes.
Historical context
Hexadecimal exists because binary is correct but unreadable. A single byte is eight binary digits, and holding 11010110 in your head while comparing it with another is genuinely hard. Sixteen is a power of two, so each hex digit maps onto exactly four bits with no arithmetic at all — 1101 is D, 0110 is 6, and the byte becomes D6. That clean four-to-one mapping is the entire reason for the notation, and it is why a byte is always two hex digits and never an awkward fraction of one. The convention spread through IBM's System/360 in the 1960s and became universal. It is why memory addresses, colour codes, MAC addresses and hash digests are all written in hex: a 24-bit colour needs six hex digits and covers 16,777,216 values, and FF means 255 to anyone who has worked with a byte. Octal, grouping three bits at a time, was common earlier but faded once eight-bit bytes won.
Practical recommendation
Related tools
FAQs
Why hex over octal?+
Hex maps cleanly to byte boundaries (2 digits = 1 byte). Octal needs 3 bits per digit and doesn't align.
Explore the topic
Knowledge graphMore comparisons
Two measurement systems that govern most of the world's specs and product packaging.
Two everyday temperature scales — same physics, different zero points and step sizes.
Two units of pressure that show up on every tire gauge, espresso machine and air compressor.
The three data-storage tiers everyone meets — and how SI decimal differs from binary IEC units.