← All lessons

The Binary Number System

IGComputer Science
~20 min
Cambridge IGCSE 0478 — Topic 1.1 Number Systems

By the end of this lesson you will be able to

  1. Given any 8-bit binary number, convert it to denary within 60 seconds using the place-value method.
  2. Given any denary number from 0 to 255, convert it to an 8-bit binary number with full working.
  3. Explain why modern computers use binary instead of denary, referring to the physical behaviour of electronic components.
  4. State the range of denary values representable by N bits (for N ≤ 8) and justify the largest and smallest values.
Prerequisites (3)
  • Basic arithmetic (addition and subtraction)
  • Denary place value (e.g. understanding that in 243 the "2" means 200)
  • Powers of a number (e.g. 2³ = 8)

2. Hook

Here's a puzzle.

You have four light switches in a row. Each one is either ON or OFF. How many different patterns can your switches make? And once you've worked that out — what's the highest number you could count to with them, if you and a friend agreed on a system?

Hold on to your answer. In the next twenty minutes you'll find out why computers store everything — every photo, every song, every line of this page — using nothing but long rows of switches like these.

3. Why this matters

Every IPv4 address you've typed — 192.168.1.1, the one printed on the back of your router — is a binary number in disguise. Each of those four chunks fits a value from 0 to 255, because that is exactly the range you can reach with 8 switches. The same is true for every pixel on this screen (each colour built from 8 bits of red, 8 of green, 8 of blue) and every file size your phone reports.

Binary is not an abstraction bolted on top of computers. It is what computers physically are.

Real-world anchor. Your router stores its own address — like 192.168.1.1 — as four 8-bit binary numbers. The 192 part is stored internally as 11000000. By the end of this lesson, you will be able to verify that by hand.

4. Prerequisites refresher

You should be comfortable with:

30-second recap — denary place values: 100=110^0 = 1, 101=1010^1 = 10, 102=10010^2 = 100, 103=100010^3 = 1000. Each column is ten times the one to its right. Keep this idea in mind — binary does the same thing with a different multiplier.

5. Intuition pass

Binary is the same idea you already know

Take the denary number 4,237. You read it without thinking:

4,237  =  4×1000+2×100+3×10+7×14{,}237 \;=\; 4 \times 1000 + 2 \times 100 + 3 \times 10 + 7 \times 1

Four columns. Each column is ten times the column to its right: 1, 10, 100, 1000. That's the only reason denary works. You have ten digits available (0–9), so each column is worth ten of the one to its right.

Now imagine you only had two digits available: 0 and 1. Same idea, different multiplier. Each column is worth two of the one to its right:

1,  2,  4,  8,  16,  32,  64,  128,  1, \; 2, \; 4, \; 8, \; 16, \; 32, \; 64, \; 128, \; \ldots

That's it. That's binary. (This framing — binary as "place value with a different base" — comes from Kalid Azad's Better Explained. Credit in Section 11.)

A number like 00101011 means: take the place values where there's a 1, and add them up:

001010112  =  32+8+2+1  =  431000101011_2 \;=\; 32 + 8 + 2 + 1 \;=\; 43_{10}

The little subscript tells you which base a number is in: 431043_{10} is denary, 00101011200101011_2 is binary. We'll drop the subscript when context makes it clear.

Try it yourself

The visualization below is the tool to play with. Each circle is one bit — one binary digit. Click a bulb (or Tab to it and press Space) to switch it on and off. Watch the denary number at the top change.

Denary value
43
Binary
00101011
Interactive 8-bit binary counterEight circular bulbs in a row, each representing one bit. A lit bulb contributes its place value (128, 64, 32, 16, 8, 4, 2, or 1) to the denary total shown above. Toggle any bulb by clicking it or focusing it and pressing Space.01282^70642^61322^50162^4182^3042^2122^1112^0
32 + 8 + 2 + 1 = 43
Click a bulb, or Tab to focus and press Space. Arrow keys move between bulbs.

Before you go on, try to make these numbers:

  1. 43 — the example from above. Should match what's already set.
  2. 100
  3. 255 — what does that look like? Why?
  4. 192 — the first chunk of 192.168.1.1. Does your answer match the 11000000 claim from earlier?
Checkpoint — predict first

Before you toggle anything: what do you predict the binary for 192 will look like? Will it have lots of 1s or few 1s? Why?

Write something first.

How binary counts

You've seen what a binary number is. Now watch how binary counts. Press Play below and keep your eyes on the columns: the 1s column flips on every step, the 2s column on every second step, the 4s column on every fourth.

When a column full of 1s gets one more, it rolls back to 0 and carries — the same motion as a car odometer going from 0999 to 1000. This is the carry rule you'll use for binary addition in Lesson 3.

The binary odometer

Count up by 1 and watch which columns flip.

0 / 15
0
8
0
4
0
2
0
1
Watch the pattern: the 1s column flips on every step, the 2s column every 2 steps, the 4s column every 4 steps. That is place value in motion.
Checkpoint — predict first

The counter shows 0111 (denary 7). Predict the next value: which bits flip when you add 1, and what is the new binary pattern?

Write something first.

6. Formal pass

Definitions

Positional notation

An nn-bit unsigned binary number bn1bn2b1b0b_{n-1} b_{n-2} \ldots b_1 b_0 has the denary value:

i=0n1bi2i\sum_{i=0}^{n-1} b_i \cdot 2^i

where each bib_i is either 0 or 1. This formula is worth reading slowly: it says "take each bit, multiply it by its place value (2i2^i), and add the results."

For an 8-bit byte, the place values are:

Bit position76543210
Place value1286432168421
Power of 2272^7262^6252^5242^4232^3222^2212^1202^0

Range of an N-bit number

With nn bits you have 2n2^n distinct patterns, so you can represent denary values from 00 to 2n12^n - 1.

The pattern 11111111 gives 128+64+32+16+8+4+2+1=255128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255, not 256. The count of patterns is 256, but the largest value is one less than the count — because 00000000 also counts as a pattern, and it represents 0. Students trip on this constantly. Don't.

Checkpoint — quick check

What is the largest denary number you can store in 6 bits?

Choose one option
Pick an option first.

Why binary?

A transistor — the basic building block of every CPU — reliably holds one of two voltage levels: roughly "high" or roughly "low." That's two states. If you tried to build hardware that reliably distinguished ten voltage levels, you'd need components that are more precise, more expensive, and far more easily confused by electrical noise. Early denary computers did exist (the ENIAC, for one), and they lost. Binary won because it matches the physics of switches.

So the answer to "why binary?" is not historical and not arbitrary: it's because two states are cheap and noise-tolerant; ten states are not.

7. Application pass

Worked example: convert 77 to binary

You know how to read binary now. Going the other direction — denary to binary — needs a method. Here's the one Cambridge expects you to use: the place-value subtraction method.

The idea: walk from the largest place value (128) down to the smallest (1). At each step, ask "does this place value fit into what's left?" If yes, write a 1 and subtract. If no, write a 0 and move on.

Work through the walkthrough below. Press Next step to advance.

Converting denary → binary
77????????
Remaining77
128
·
64
·
32
·
16
·
8
·
4
·
2
·
1
·

Start: we need to build 77 from the place values 128, 64, 32, 16, 8, 4, 2, 1.

Step 0 / 8

In words, the sequence for 77 was:

  1. 128 into 77? No → 0.
  2. 64 into 77? Yes → 1. Remainder: 13.
  3. 32 into 13? No → 0.
  4. 16 into 13? No → 0.
  5. 8 into 13? Yes → 1. Remainder: 5.
  6. 4 into 5? Yes → 1. Remainder: 1.
  7. 2 into 1? No → 0.
  8. 1 into 1? Yes → 1. Remainder: 0.

Reading the bits top to bottom: 01001101. Check by adding: 64+8+4+1=7764 + 8 + 4 + 1 = 77. ✓

The verification step matters. In an exam, always add your binary number back to denary — it catches arithmetic slips in under ten seconds.

Checkpoint — concept check

You're converting 100 to binary. You have decided the 64 bit is a 1 (remainder = 36). What should you do next?

Choose one option
Pick an option first.

Application: decoding an IP octet

Back to the real-world anchor. The first byte of 192.168.1.1 is 192. Convert it by hand:

Result: 11000000. That string of bits, shuffled around inside a network card, is how your router identifies itself to every device on your WiFi. You've reversed a piece of real network plumbing.

8. Summary

Five things worth remembering in six months:

  1. Binary is place value with base 2. Each column is twice the column to its right: 1, 2, 4, 8, 16, 32, 64, 128.
  2. A bit is one binary digit. A byte is 8 bits. One byte covers the denary range 0 to 255.
  3. To convert binary → denary: add up the place values where there's a 1.
  4. To convert denary → binary: walk from 128 down to 1. If the place value fits, write 1 and subtract; otherwise write 0.
  5. Computers use binary because transistors reliably hold two states, not ten. The reason is physical, not historical.

9. Quiz

Seven questions, mixed types. Expect about 10 minutes.

Question 1 of 7
0 / 20
Multiple choice2 points

What is 00110101 in denary?

Answer options

Practice exam available

Take the 15-question exam for this lesson

Auto-graded multiple-choice questions. You'll see your percentage, letter grade, and a question-by-question review after submitting.

Start exam →

10. Further practice

Work through these seven problems — solutions in practice-solutions.md (kept separate so you can attempt them first without peeking).

  1. Convert 00010110 to denary.
  2. Convert 11110000 to denary.
  3. Convert 89 to 8-bit binary.
  4. Convert 200 to 8-bit binary.
  5. What is the largest denary number that fits in 8 bits? Show your reasoning.
  6. A 4-bit counter currently shows 1011. Write the next three values it will show, in binary and denary.
  7. Without converting digit by digit: is 10011010 even or odd? How can you tell from one single bit?

Extension (for students aiming at A*): How many bits would you need to store any number from 0 to 1,000,000? Derive your answer, don't guess it.

11. Further reading

Pedagogy and framings adopted here — reuse them, don't copy them:

Syllabus and exam resources:


Version 1 — published 2026-04-24. Revise this file when a recurring student confusion surfaces, not for one-off corrections.