Unit 1 · Digital Information · Lesson 1.2

Binary ↔ Decimal

The one skill in this unit the exam is guaranteed to ask you about. Today it becomes automatic.

Big Idea 2 — Data

Before this lesson — read on Runestone

Short page. Enrolled in our Runestone course? Open it from there so your progress counts.

1

Where We Are

People→ Bits→ Programs→ Internet→ Security→ Big Data→ Impact

Still in Bits. In 1.1 you learned that columns double as you move left, and you read 10011 as 19 by adding up columns. That was the idea. This lesson is the practice — both directions, until you stop having to think about it.

2

The Hook

10 There are 10 kinds of people in the world: those who understand binary, and those who don't.

That's the joke. It is written on the board, and it is not going to be explained. If it doesn't land yet, it will by the end of this page — and the moment it does is the moment you've actually got this.

3

The Idea

You have been doing place value since first grade. Nobody ever called it that, so here it is spelled out. When you read 4,271, you are not reading four symbols. You are reading a sum:

4×1000  +  2×100  +  7×10  +  1×1  =  4,271

Each column is worth ten times the column to its right. Why ten? Because you have ten symbols — 0 through 9 — and once you run out, you have to start a new column. That's all "base-10" means: the number of symbols is what sets the column multiplier.

Binary has two symbols. Same rule, different number. Each column is worth two times the column to its right:

BaseSymbolsColumns, right to left
base-10 (decimal)0–91, 10, 100, 1000, 10000…
base-2 (binary)0, 11, 2, 4, 8, 16, 32, 64, 128…

Direction 1: binary → decimal (the easy one)

Write the column values above the bits. Add up the ones that have a 1 under them. Ignore the zeros entirely.

  64  32  16   8   4   2   1
   1   0   0   1   1   0   1

64 + 8 + 4 + 1 = 77

That's the whole method. There's no second step.

Direction 2: decimal → binary (the one people fumble)

Go the other way by subtracting the biggest power of 2 that fits, over and over, writing a 1 each time it fits and a 0 each time it doesn't. Convert 77:

Does 64 fit in 77?  yes → write 1,  77 − 64 = 13
Does 32 fit in 13?  no  → write 0
Does 16 fit in 13?  no  → write 0
Does  8 fit in 13?  yes → write 1,  13 −  8 =  5
Does  4 fit in  5?  yes → write 1,   5 −  4 =  1
Does  2 fit in  1?  no  → write 0
Does  1 fit in  1?  yes → write 1,   1 −  1 =  0

77 = 1001101

When the remainder hits 0 you're done — every remaining column is a 0. And you can always check yourself for free by converting back the easy direction: 64 + 8 + 4 + 1 = 77. Do that check every single time on the exam. It costs five seconds and it catches the mistake.

The fluency that actually saves you time. Both directions run on knowing the powers of 2 cold, without counting up to them:

1  2  4  8  16  32  64  128  256

Nine numbers. That's the whole list you need for this course, and it's the daily warm-up from here on. Students who know these instantly finish conversion questions in about fifteen seconds. Students who don't, rebuild the list from scratch every time and run out of clock.

4

Try It

Three drills. Do them until the streak counter annoys you into being accurate. Wrong answers show the full worked solution — read it before moving on.

Convert this binary number to decimal:
 
Streak: 0  ·  0 correct of 0

The paper version — do this one by hand

Fold a page in half. On the left, write five binary numbers of your own invention, 6 or 7 bits each. On the right, write five decimal numbers between 20 and 200.

Trade with a partner. Convert theirs, then check each other's work by converting back — not by comparing answers. Finding your own mistake is the skill; being told the answer isn't.

Done a few conversions? Then go back and read the hook again. Convert the 10.

5

Vocabulary

You just used all three of these. Now they get names.

place value Bits
The idea that a digit's worth depends on which column it sits in, and that each column is worth a fixed multiple of the column to its right.
base-10 (decimal) Bits
The everyday number system, using ten symbols (0–9), where each column is worth ten times the one to its right.
base-2 (binary) Bits
The number system computers use, with two symbols (0 and 1), where each column is worth twice the one to its right.
6

Check

Five questions in AP format. Pick an answer to see feedback immediately.

0 of 5 answered
7

Impact Check

A number is meaningless without its convention

The joke works because 10 has no fixed meaning. It means 2 or it means ten, and nothing about the digits themselves tells you which. The meaning lives in an agreement between whoever wrote it and whoever reads it.

Mars Climate Orbiter, September 1999. After a nine-month flight, a $327 million NASA spacecraft flew too low into the Martian atmosphere and was destroyed. The engineering review found that one team's software produced thrust values in pound-force seconds while the receiving system expected newton-seconds. Both numbers were correct. Neither system was broken. They simply disagreed about what the numbers meant, and nothing in the data itself said so.

To be precise: that was a units mismatch, not a base mismatch. The shared lesson is the one worth carrying — data does not carry its own interpretation. A pattern of bits is just a pattern of bits until a convention says what to make of it, and that convention has to be agreed on explicitly, because the data will never warn you.

8

Connections

Came from 1.1 — you met the doubling columns and read one binary number. This lesson turned that into a two-way skill you can do under time pressure.
Next in 1.3 — the powers of 2 you just memorized become the thing that breaks real software, because a column you don't have is a number you can't store.
Returns in 1.4 and 1.5 — every letter and every pixel color is a number, and you'll be converting them constantly.
Returns on the exam — conversion questions are close to guaranteed in Big Idea 2. The most common way to lose the point is arithmetic, not method, which is why you convert back to check.
← 1.1 Two Symbols Are Enough