Library Computer Science 0478 Number Systems
O Level · Computer Science 0478

Number Systems

Revise Number Systems for Computer Science 0478 (O Level) — revision notes and instant AI marking. Free to start.

📖 Revision notes · preview
Cambridge IGCSE Computer Science 0478

Number Systems

Computers only understand ON and OFF — every number, letter, colour and sound you'll ever see on a screen is really just patterns of 1s and 0s underneath. This guide shows you how to read, write, and convert between the three number systems computers and humans use to talk about that data: denary, binary, and hexadecimal.

Summary — What This Chapter Covers

  • Why binary? Logic gates only have two states (on/off), so binary (1/0) is the natural fit for computer hardware.
  • Three number systems: denary (base-10, for humans), binary (base-2, for computers), hexadecimal (base-16, a human-friendly shorthand for binary).
  • Conversions: denary ↔ binary, denary ↔ hexadecimal, and binary ↔ hexadecimal (using nibbles).
  • Why hex exists: it's shorter to write and easier for humans to read/copy accurately than long strings of binary — used in MAC addresses, colour codes, and URLs.
  • Binary addition: adding two binary numbers together, including how carrying works and what happens when you run out of bits (overflow).
  • Binary shifts: moving bits left or right to multiply or divide by powers of 2.
  • Two's complement: how computers represent negative numbers using only 1s and 0s.

1. Why Computers Use Binary

The core reason

Inside every computer, data is processed using logic gates — tiny electronic switches that can only be in one of two states: on or off, high voltage or low voltage, current flowing or not flowing. There's no "half on."

Binary is the number system that's made up of exactly two digits — 1 and 0. This lines up perfectly: 1 can represent "on" and 0 can represent "off." Because of this natural match, all data — text, images, sound, video — must be converted into binary before a computer can understand and process it.

Analogy: The car accelerator
Think about driving a car. A real accelerator pedal lets you speed up gradually — 50mph, 60mph, 100mph, anything in between. But a computer's "accelerator" only has two settings: 50mph (0) or 100mph (1). There's no gradual in-between state. Trying to build hardware with more than two states would make the circuitry far more complex and less efficient — so engineers stick with simple two-state logic gates, and binary is the number system that matches them.

Where you can actually see this happening

Secondary storage devices physically store binary using two-state properties:

  • Magnetic hard drives use North and South magnetic polarity to represent a 1 or a 0.
  • Optical disks (CDs/DVDs) use a laser: light hitting a flat area (land) is read as a 1, and light hitting a bump (pit) is read as a 0.
Exam-ready answer "Computers process data using logic gates, and logic gates can only have two states (on/off), which is represented using the digits 1 and 0 in binary."
Practice Question

Explain why computers process data in binary format. [2 marks]

2. The Three Number Systems

2.1 Denary (base-10)

This is the number system you already use every day — made up of 10 digits (0–9). Each digit's position (column) has a weight which is 10 raised to a power. Starting from the right: 10⁰ = 1s, 10¹ = 10s, 10² = 100s, 10³ = 1000s, and so on. Every time you move one column to the left, the value is multiplied by 10.

Column heading (using 10ˣ)1000 (10³)100 (10²)10 (10¹)1 (10⁰)
Digit3268

Reading this: (3×1000) + (2×100) + (6×10) + (8×1) = 3268. To represent bigger numbers, you simply add more digits (more columns) to the left.

2.2 Binary (base-2)

Made up of only two digits (0 and 1). Just like denary, each column has a weight — but this time it's 2 raised to a power. From the right: 2⁰ = 1, 2¹ = 2, 2² = 4, 2³ = 8... Each new column to the left doubles the previous column's value (rather than ×10 like denary).

Column heading (using 2ˣ)8 (2³)4 (2²)2 (2¹)1 (2⁰)
Digit1100

Reading this: binary 1100 = (1×8) + (1×4) + (0×2) + (0×1) = 12 in denary.

The full set of column headings you need for IGCSE (up to 16-bit, Cambridge's limit) is:

32,76816,3848,1924,0962,0481,0245122561286432168421
Good to know
The largest denary number you can represent using 16 bits is 65,535 (binary 1111111111111111). This is why you'll sometimes see values capped at 65,535 or 255 (8-bit) in exam questions — it's the ceiling of what those bit-lengths can hold.

2.3 Hexadecimal (base-16)

Made up of 16 digits — the numbers 0–9, plus the letters A–F standing in for 10–15 (since we've run out of single digits after 9!). Each column's weight is 16 raised to a power: 16⁰ = 1s, 16¹ = 16s. For IGCSE, you only need to work with 2-digit hexadecimal values.

Denary0123456789101112131415
Hex0123456789ABCDEF

Example: hex 13 = (1×16) + (3×1) = 19 in denary.

Key relationship to remember One hexadecimal digit always represents exactly four bits of binary (called a nibble). This is THE fact that makes binary ↔ hex conversion fast.
DenaryBinaryHex
000000
100011
200102
300113
401004
501015
601106
701117
810008
910019
101010A
111011B
121100C
131101D
141110E
151111F
Memory tip
Write this whole 0–F table out from memory at the start of your exam. Examiner reports mention this every single year as the #1 trick to avoid silly mistakes when converting.

3. Converting Between Binary & Denary

3.1 Denary → Binary

Method:

  1. Write out the binary number line (column headings), starting with the first heading larger than your denary number, then every heading to the right of it down to 1.
  2. Start at the leftmost empty column. Ask "how many times does this heading fit into my remaining number?" — the answer is always 0 or 1 for binary.
  3. Write down the remainder, move to the next column, and repeat until every column has a value.

Worked example: Convert denary 45 to binary.

The first heading bigger than 45 is 64, so our number line starts at 32:

32168421
101101

32 fits into 45 once, remainder 13. 16 doesn't fit into 13, so 0. 8 fits into 13 once, remainder 5. 4 fits into 5 once, remainder 1. 2 doesn't fit into 1, so 0. 1 fits into 1 once, remainder 0.

Result: 45 = 101101 in binary (6 bits).

Common trap
If the question says "give an 8-bit answer," you MUST pad your result with leading zeroes to reach 8 digits. So 45 → 00101101, not just 101101. Missing this loses easy marks.
Practice Question

Convert denary 3059 to binary.

3.2 Binary → Denary

Method: Write out the column headings for the number of bits given (from right to left), place each binary digit under its heading, then add together every column heading that has a 1 underneath it.

Worked example: Convert binary 01100011 (8 bits) to denary.

1286432168421
01100011

(1×64) + (1×32) + (1×2) + (1×1) = 99

Quick sanity check
If a binary number ends in 1, its denary value must be odd. If it ends in 0, the denary value must be even. Use this to catch mistakes fast in the exam!
Practice Question

Convert binary 01110001110100 (14 bits) to denary.

4. Converting Between Hexadecimal & Denary

4.1 Denary → Hexadecimal

Method 1 — via binary (safest, no calculator needed):

  1. Convert the denary number to 8-bit binary.
  2. Split the 8 bits into two nibbles (groups of 4).
  3. Convert each nibble to its denary value, then to its hex digit.

Example: Convert denary 28 to hex.

28 in binary = 0001 1100. First nibble 0001 = 1. Second nibble 1100 = 12 = C. So 28 = 1C in hex.

Method 2 — divide by 16:

Divide the denary number by 16. The whole number of times it goes in becomes hex digit 1; the remainder becomes hex digit 2.

Example: Convert 163 to hex. 163 ÷ 16 = 10 remainder 3. Digit 1 = 10 = A. Digit 2 = 3. So 163 = A3 in hex.

Which method should I use?
Remember — the exam is non-calculator. If you're not confident dividing by 16 in your head, always fall back on Method 1 (via binary). It's slower but foolproof, and Cambridge accepts either method for full marks.

4.2 Hexadecimal → Denary

Method 1 — via binary: convert each hex digit to its 4-bit nibble, join the nibbles into a byte, then convert binary → denary as normal.

Example: Convert hex B9 to denary.

B = 1011, 9 = 1001 → joined: 10111001(1×128)+(1×32)+(1×16)+(1×8)+(1×1) = 185

Method 2 — multiply by 16: multiply the first hex digit's denary value by 16, then add the second digit's denary value.

Example: Convert hex 79 to denary. 7 × 16 = 112, then 112 + 9 = 121.

Practice Question

Convert hex 4E to denary using both methods, and check your answers agree.

5. Converting Between Hexadecimal & Binary

This is the conversion you'll use most often, because it relies purely on the nibble rule — one hex digit = 4 bits — with no denary maths required at all.

5.1 Binary → Hexadecimal

  1. Split the binary number into groups of 4 bits (nibbles), starting from the right.
  2. Convert each nibble to its denary/hex value using the table.
  3. Join the two hex digits together.

Example: Convert binary 10110111 to hex.

84218421
10110111

First nibble = 8+2+1 = 11 = B. Second nibble = 4+2+1 = 7 = 7. Result: B7.

5.2 Hexadecimal → Binary

  1. Split the hex digits apart.
  2. Convert each digit to its 4-bit binary nibble.
  3. Join the nibbles together to form the full binary number.

Example: Convert hex 5F to binary.

5 = 0101, F = 1111 → joined: 01011111

Don't skip steps
Some shortcuts online skip writing out the full 8-bit binary number. In the exam, always write the complete nibbles and join them clearly — Cambridge mark schemes reward showing this working, and skipping it risks losing method marks even if your final answer is right.
Practice Question

Convert hex 26 to binary, and then convert binary 00111001 to hex. (Check they don't accidentally match!)

6. Why Do We Even Bother With Hexadecimal?

You might be wondering — if computers only understand binary, why do we need hexadecimal at all? The answer is entirely about humans, not computers.

The exam-approved reasoning Hexadecimal needs fewer digits to represent a given value than binary does, which means it's easier for a human to read and there's less chance of copying errors when writing it down.
Exam phrasing matters
Don't just write "hex is shorter" or "hex is easier" — that's too vague to earn marks. Use the exact phrases: "fewer digits = easier for humans to read" and "less chance of copying errors." These match the mark scheme language examiners are looking for.

Think about it concretely: a MAC address needs 48 bits of binary to represent. Would you rather read/copy this...

10101010:10111011:11001100:11011101:11101110:11111111

...or this equivalent, written in hex?

AA:BB:CC:DD:EE:FF

Same information, but the hex version is a quarter of the length and far less error-prone to copy by hand.

Where hexadecimal is actually used

  • MAC addresses: a unique network hardware identifier — 12 hex digits (48 bits in binary), e.g. 2C-F0-7C-A7-98.
  • Colour codes: web/screen colours use 6 hex digits (24 bits in binary) — 2 digits each for Red, Green, Blue. E.g. #66FF33 is a shade of green: 01100110 : 11111111 : 00110011.
  • URLs: a URL can only officially contain standard letters (a-z, A-Z), numbers (0-9), and a small set of special symbols. If a URL needs a character outside this set, it gets converted into a hexadecimal code, prefixed with a % sign.
Practice Question

A student says "hexadecimal is used because it's shorter than binary." Explain why this answer would likely lose a mark, and rewrite it to gain full marks.

7. Binary Addition

Binary addition works just like the column addition you learned in primary school for denary numbers — except there are only two digits, so the "carrying" rules are simpler but happen much more often.

The 5 golden rules

SumResultWorking
0 + 00no carry
0 + 11no carry
1 + 01no carry
1 + 110write 0, carry 1
1 + 1 + 111write 1, carry 1
Rule Add from right to left, just like denary. Whenever a column's total is 2 or more, write down the rightmost digit of that total and carry the rest to the next column on the left.

Worked example: Add binary 00011001 (25) and 10001001 (137).

1286432168421
00011001
10001001
carries: 1 in the 2s column, 1 in the 32s column, 1 in the 16s column
10100010

Result: 10100010 = 162 in denary. Check: 25 + 137 = 162 ✓

Free marks alert
You can earn marks just for showing carries correctly, even if your final total is wrong. Always show your carry bits clearly above or below the sum row — examiner reports confirm this matters for partial credit.

Overflow errors

An overflow error happens when the result of an addition needs more bits than you have available. For example, adding 11111111 (255) + 00000001 (1) in 8 bits would need a 9th bit to store the answer (256) — that 9th bit gets lost, causing an overflow error and an incorrect result.

Overflow trigger
In 8-bit unsigned binary addition, watch for any sum that would exceed 255 — that's Cambridge's favourite overflow trap.
Practice Question

Add binary 1001 (9) and 0100 (4), showing your carries. Does an overflow occur?

8. Binary Shifts

A logical binary shift is how computers perform quick multiplication and division on non-negative numbers — by physically sliding every bit left or right along the row.

The core rule A left shift of 1 place multiplies the number by 2 (×2).
A right shift of 1 place divides the number by 2 (÷2).
Shifting 2 places = ×4 or ÷4. Shifting 3 places = ×8 or ÷8 — and so on.

Left shift example

Shift binary 00101000 (denary 40) left by 1 place. Every bit moves one column left; the empty column on the right (the 1s column) is filled with a 0.

1286432168421
0101000= 40
01010000= 80

40 doubled to 80. ✓

Right shift example

Shift binary 00101000 (denary 40) right by 1 place. Every bit moves one column right; the bit that falls off the right-hand edge (the LSB) is lost, and a 0 fills the empty column on the left.

1286432168421
0010100= 40
00010100= 20

40 halved to 20. ✓

Scope reminder
Cambridge IGCSE only expects you to shift 8-bit unsigned integers. You won't be asked about longer binary values or negative (two's complement) shifts.

Overflow in shifts

Overflow in a left shift happens when a 1 is pushed out of the leftmost column (MSB) and lost — this changes the value's meaning drastically, since important high-value data is discarded. You generally only need to spot overflow on left shifts, not right shifts, at this level.

Practice Question

Shift binary 00011100 (denary 28) left by 2 places. What's the new denary value? Does overflow occur?

9. Two's Complement

So far, every binary number we've used has been positive (unsigned). But computers need to represent negative numbers too — and they can't use a "minus sign" because that's not a 1 or a 0! The solution is two's complement: a clever system for representing signed (positive AND negative) numbers using only binary digits.

The key idea In two's complement, the leftmost bit (the Most Significant Bit, MSB) is special. In 8-bit two's complement, this column's weight is −128 instead of +128. Every other column keeps its normal positive value. If the MSB is 1, the number is negative.

Example: What does 11111111 represent?

−1286432168421
11111111

Add up every column with a 1: −128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = −1. So 11111111 represents −1 in two's complement.

Converting a negative number TO two's complement

The reliable method:

  1. Write out the positive version of the number in normal binary.
  2. Starting from the rightmost bit, copy every digit across unchanged up to and including the first 1 you encounter.
  3. For every digit after that first 1 (moving left), invert it — flip every 0 to a 1 and every 1 to a 0.

Worked example: Represent −76 in 8-bit two's complement.

Step 1: Positive 76 in binary = 01001100

−1286432168421
01001100

Step 2: Copy from the right up to and including the first 1 — that's the rightmost 1 in the 4s column, plus the two 0s to its right (2s, 1s columns): 1 0 0 stays unchanged.

Step 3: Invert everything to the left of that: 0 1 0 01 0 1 1

−1286432168421
10110100

Check: −128 + 32 + 16 + 4 = −76

Result: −76 = 10110100 in two's complement.

Which method to use
You may have seen the "flip all bits and add 1" trick elsewhere — it works too, but the "copy from the right, then invert" method shown here is what Cambridge examiners prefer to see, since it's reliable, repeatable, and clearly shows your working for method marks.
Practice Question

Represent −20 in 8-bit two's complement.

What to Memorise

Binary (base-2)
2 digits (0,1). Column weights are powers of 2: 1, 2, 4, 8, 16, 32, 64, 128...
Denary (base-10)
10 digits (0-9). Column weights are powers of 10.
Hexadecimal (base-16)
16 digits (0-9, A-F). Column weights are powers of 16.
Nibble
4 bits = exactly 1 hexadecimal digit.
Byte
8 bits = exactly 2 hexadecimal digits.
Why binary?
Logic gates only have 2 states (on/off) — matches binary's 2 digits.
Why hex?
Fewer digits = easier for humans to read + less chance of copying errors.
Left shift
Multiplies by 2 per place shifted. Fills empty column(s) on the right with 0.
Right shift
Divides by 2 per place shifted. Fills empty column(s) on the left with 0; bits shifted off the right are lost.
Overflow (addition)
Result needs more bits than available — e.g. exceeding 255 in 8-bit unsigned.
Overflow (left shift)
A 1 is pushed out of the leftmost (MSB) column and lost.
Two's complement MSB
In 8-bit, the leftmost column has weight −128 instead of +128.
Two's complement method
Write positive binary → copy digits from the right up to & including the first 1 → invert everything left of that.
Largest 16-bit denary value
65,535 (binary 1111111111111111).
Largest 8-bit denary value
255 (binary 11111111).
Hex uses (memorise these 3)
MAC addresses (12 hex digits), colour codes (6 hex digits), URLs (% prefix for special characters).

Concepts Checklist

Exam Tips

Use exact mark-scheme phrasing
"Computers understand binary" is NOT enough for "why binary" questions — you must say "logic gates have two states." Similarly for hex, say "fewer digits = easier to read + fewer copying errors," not just "hex is shorter."
Always write out the hex table first
Before starting any hex conversion, quickly jot down 0-F and their denary equivalents (10=A, 11=B... 15=F) at the top of your working. This avoids silly slip-ups under time pressure.
Watch the bit-length requested
If a question specifies "8-bit" or "16-bit," pad your binary answer with leading zeroes to match. Losing marks for a technically-correct-but-wrong-length answer is one of the most common mistakes.
Overflow is a favourite trick question
If binary addition would push the result past 255 (8-bit unsigned) or if a left shift pushes a 1 out of the MSB, that's an overflow — examiners test this constantly. Always double check your sum against the bit limit given.
Show ALL your working
For addition, shifts, and two's complement especially — showing carries, shifted columns, and inverted digits clearly earns method marks even if your final answer has a small error. Never just write the final answer alone.
No calculator allowed
The exam is non-calculator. If dividing by 16 (for hex conversions) feels risky, fall back on the binary method every time — it's slower but far less error-prone under exam pressure.
🔓 Read the full Number Systems note — free You're seeing the preview · free account, no card needed
Also in the full note
  • 3. Converting Between Binary & Denary
  • 4. Converting Between Hexadecimal & Denary
  • 5. Converting Between Hexadecimal & Binary
What's inside
📖 Revision notes 🎯 Learn mode ✦ AI flashcards ✓ Instant AI marking 🧊 3D explorers 🧪 Experiments & simulations 📈 Progress tracking
📄 Practise Number Systems with Computer Science 0478 past papers Every paper with its mark scheme — answer online, marked instantly. Open →

Read the full Number Systems notes free

That's the preview — create a free account to read the rest, plus flashcards and practice questions with instant AI marking. No credit card.

Unlock the full notes free →

More Computer Science topics