Binary, decimal and hexadecimal - counting with different amounts of fingers
Why computers count in binary, how place value math actually works, and how to freely convert between binary, decimal and hex by hand.
Counting with two fingers
You count in decimal (base 10) because you happen to have ten fingers. If you only had two fingers, you'd naturally count in binary (base 2): 0, 1, then you'd run out of fingers and have to "carry" — exactly like you carry a 1 when adding 9 + 1 in decimal.
A computer only has two-state switches, so it counts in binary out of necessity, not preference. Nothing about binary is mathematically special — it's simply the counting system that matches a two-state switch.
Place value is the whole trick
You already know place value in decimal without thinking about it. The number 345 means:
Each position is worth ten times the position to its right, because you're in base 10. Binary works identically, except each position is worth two times the position to its right, because you're in base 2:
That single formula, , is the entire mathematical content of binary numbers. Everything else is bookkeeping.
Converting decimal to binary
To convert a decimal number to binary, repeatedly divide by 2 and record the remainders, then read them bottom to top. Let's convert :
| Step | Division | Quotient | Remainder |
|---|---|---|---|
| 1 | 13 ÷ 2 | 6 | 1 |
| 2 | 6 ÷ 2 | 3 | 0 |
| 3 | 3 ÷ 2 | 1 | 1 |
| 4 | 1 ÷ 2 | 0 | 1 |
Reading the remainders bottom-to-top gives . Check it: . Correct.
Hexadecimal: binary's shorthand
Writing long strings of 1s and 0s is exhausting and error-prone for humans, so engineers use hexadecimal (base 16) as a compact shorthand. Hex uses sixteen symbols:0–9, then A–F standing in for ten through fifteen.
The reason hex is so convenient is that , so exactly 4 binary bits map to exactly 1 hex digit, with no messy leftover:
| Binary | Hex | Binary | Hex |
|---|---|---|---|
| 0000 | 0 | 1000 | 8 |
| 0001 | 1 | 1001 | 9 |
| 0010 | 2 | 1010 | A |
| 0011 | 3 | 1011 | B |
| 0100 | 4 | 1100 | C |
| 0101 | 5 | 1101 | D |
| 0110 | 6 | 1110 | E |
| 0111 | 7 | 1111 | F |
10110110:
That's why memory addresses and error codes are almost always shown in hex —
0xB6 is much easier for a human to read, type and remember than 10110110, while still translating perfectly cleanly to and from binary.
Octal, briefly
You'll occasionally see octal (base 8), where 3 bits map to 1 digit (since ). It's mostly a historical leftover from early computers and Unix file permissions (chmod 755); the exact same place-value math applies, just with base 8 instead of base 16.
Binary addition, the same way you learned decimal addition
Binary addition follows the exact same carrying rule as decimal, just with a smaller alphabet:
Adding (5) and (3):
0101 (5)
+ 0011 (3)
------
1000 (8)
Column by column from the right: (write 0, carry 1), (write 0, carry 1), (write 0, carry 1), . Result: . Correct.
Common mistakes
- Reading binary like decimal.
10in binary is two, not ten. Always ask "what base?" before reading a number out loud. - Forgetting the leftmost bit is the biggest place value, not the smallest — the same left-to-right convention as decimal.
- Padding hex-to-binary conversions incorrectly. Each hex digit is always exactly 4 bits, even if some of those bits are leading zeros —
0x3is0011, not11.
Summary
Computers count in binary because a transistor only has two reliable states. Binary place value works identically to decimal place value, just with powers of 2 instead of powers of 10: . Hexadecimal exists purely as a human-friendly shorthand for binary, with each hex digit representing exactly 4 bits since . Every number system you'll meet in this course is the same idea with a different base.