Place Value and Number Bases
Rediscover place value in our base-10 system, see how the same idea works in any base and find out why computers chose base 2.
Welcome back!
Step 1 of 12Learn
You already know a number system
Look at the number 352. You read it instantly as three hundred fifty-two, but notice what's actually going on. The digit 3 doesn't mean three; it means three hundreds. The 5 means five tens. The 2 means two ones.
352 = 3 × 100 + 5 × 10 + 2 × 1
This is place value: a digit's value depends on its position. Each place is worth ten times the place to its right: ones, tens, hundreds, thousands. Using exponents, those places are 100, 101, 102 and 103. (Any number to the power 0 is 1.)
Our everyday system is called decimal, or base 10, because it uses ten digits, 0 through 9, and each place is worth ten times the previous one. When a place runs out of digits, as when you count past 9, you write 0 there and carry 1 into the next place: 9 becomes 10, and 99 becomes 100.
Why ten? Almost certainly because humans have ten fingers. There's nothing mathematically special about it. Ancient Babylonians used a base-60 system, which is why an hour still has 60 minutes and a circle 360 degrees. The Maya used base 20. Any whole number greater than 1 can serve as a base.
Step 2 of 12Diagram
What the digits in 352 really mean
Tap a shape with to see more.
- 352
- 3 hundreds = 300
The 3 sits in the hundreds place, worth 10 × 10.
- 5 tens = 50
The 5 sits in the tens place.
- 2 ones = 2
The 2 sits in the ones place.
Step 3 of 12Practice · Work it out
In the decimal number 7,046, what is the value of the digit 7?
Step 4 of 12Learn
The same idea in any base
Place value works the same way in every base. In base b:
- The system uses b digits, from 0 up to b − 1.
- Each place is worth b times the place to its right: b0 = 1, then b1, b2, b3 and so on.
So in base 5, the digits are 0, 1, 2, 3 and 4, and the places are worth 1, 5, 25, 125. The base-5 number 243 means:
2 × 25 + 4 × 5 + 3 × 1 = 50 + 20 + 3 = 73 in decimal.
To avoid confusion, we often write the base as a small number after the digits: 243 in base 5 is written 243_5, and 73 in decimal is 73_10. In programming, you'll also see prefixes: 0b for binary (0b1010) and 0x for hexadecimal (0x1F).
One check that catches many mistakes: a digit can never equal or exceed the base. In base 5, the digit 5 doesn't exist, for the same reason decimal has no single digit for ten. If you see "7" in a supposed base-5 number, something is wrong.
The three bases you'll use most in computing are base 2 (binary), base 16 (hexadecimal) and occasionally base 8 (octal).
Step 5 of 12Practice · Match the pairs
Match each base to its set of digits.
Tap an answer, then tap the place where it belongs (or drag it there).
- Base 2 (binary)
- Base 8 (octal)
- Base 10 (decimal)
- Base 16 (hexadecimal)
- Base 5
Step 6 of 12Compare
Four bases side by side
| Aspect | Base 2 | Base 5 | Base 10 | Base 16 |
|---|---|---|---|---|
| Digits | 0 1 | 0-4 | 0-9 | 0-9, A-F |
| Place values | 1, 2, 4, 8 | 1, 5, 25, 125 | 1, 10, 100, 1000 | 1, 16, 256, 4096 |
| Ten is written | 1010 | 20 | 10 | A |
Step 7 of 12Practice · Work it out
Convert the base-5 number 312_5 to decimal.
Step 8 of 12Learn
Why computers count in twos
If decimal is so natural for people, why do computers use binary?
Inside every chip are billions of microscopic switches called transistors. Each one is either letting electric current through or not: on or off. Storage works similarly: a tiny region is magnetized one way or the other, or a cell holds a charge or doesn't. Telling two states apart is fast, cheap and extremely reliable, even when signals get a little noisy. Trying to distinguish ten different voltage levels for ten decimal digits would be far more error-prone.
Two states fit perfectly with a number system that has two digits. Call "off" 0 and "on" 1, and every switch stores one binary digit, or bit.
A single bit can't say much: yes or no, true or false. But bits combine. Two bits can make four patterns (00, 01, 10, 11), and eight bits can make 256. With enough bits you can represent any number, any letter, any color and any sound. All the variety in your phone comes from patterns of a two-symbol alphabet.
Binary wasn't invented for computers, by the way. Mathematicians explored it centuries earlier, and Morse code and Braille also encode information with simple two-way choices (short or long, raised or flat).
Step 9 of 12Diagram
From a switch to a number
Tap a shape with to see more.
- Transistor
A tiny switch: current flows or it does not.
- Bit: 1 or 0
On means 1, off means 0. Two states are easy to tell apart reliably.
- 8 bits = a byte
Enough patterns for 256 different values.
- Number, letter or color
Programs agree what each pattern means.
Step 10 of 12Note
Step 11 of 12Practice · True or false
Computers use binary because it is the only base that can represent large numbers.
Step 12 of 12Practice · Choose one
Which of these could NOT be a valid base-6 number?
Lesson complete!