Comparison

Binary vs Hexadecimal

The two number systems that power every computer — one verbose, one compact.

Binary (base 2)Hexadecimal (base 16)
Digits0, 10–9, A–F
1 byte8 digits (e.g. 10110010)2 digits (e.g. B2)
Used inHardware, bit-level logicMemory addresses, colors
Binary (base 2) pros
  • Matches actual transistor state
  • Trivial bitwise operations
Hexadecimal (base 16) pros
  • 4× more compact than binary
  • Direct conversion (4 bits = 1 hex digit)

When to use which

Use Binary (base 2)

Use binary when reasoning about bit-level operations and hardware.

Use Hexadecimal (base 16)

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

Use hexadecimal for anything a person has to read or type — addresses, colour codes, byte dumps, checksums — and binary only when the individual bits carry meaning, as with flags, masks and hardware registers. The conversion between them needs no arithmetic: split the binary into groups of four from the right and translate each group. Prefixes are worth being explicit about, since 0x marks hex and 0b marks binary in most languages, and a number written without one is ambiguous — 10 could be two, sixteen or ten.

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 graph

More comparisons