Binary Arithmetic & Shifts

💻 Computer Science Years 9–11 Foundation

Adding 8-bit binary numbers with carries and overflow, and using binary shifts to multiply and divide by powers of two.

Open this lesson, with practice and a printable worksheet →

Once numbers are stored in binary, the computer has to do arithmetic with them. The good news is that binary addition uses just four rules — far fewer than the addition tables you learned as a child. And there is a beautifully lazy trick, the binary shift, that multiplies or divides by two just by sliding the digits sideways.

Why this matters: Adding and shifting are the raw operations a processor performs billions of times a second. Understanding them shows you how a machine can multiply without ever "knowing" its times-tables, and it explains overflow errors that can crash real programs.
0 1 1 0 0 0 1 1 = 6 = 3 = 9 + 1 0 0 1 carry 1
0110 + 0011 = 1001, i.e. 6 + 3 = 9. Watch the carries.

The four rules of binary addition

0 + 00 + 11 + 11+1+1writecarry0101——11
Four cases only. 1 + 1 = 10: write 0, carry 1.

Add column by column from the right, exactly as in denary — but you only ever meet these cases:

SumWriteCarry
0 + 00—
0 + 11—
1 + 10carry 1
1 + 1 + 11carry 1

The key idea is that 1 + 1 = 10 in binary (that's "two"), so you write 0 and carry the 1 into the next column — just like 5 + 5 = 10 makes you carry in denary.

Worked example — add 00010110 and 00001101.
That is 22 + 13. Working right to left: 0+1=1; 1+0=1; 1+1=0 carry 1; 0+1+1(carry)=0 carry 1; 1+0+1(carry)=0 carry 1; 0+0+1(carry)=1; 0+0=0; 0+0=0.
Result: 0010 0011. Check: 32 + 2 + 1 = 35, and 22 + 13 = 35. ✓

Overflow

1 1 1 1 1 1 1 10 0 0 0 0 0 0 1+0 0 0 0 0 0 0 019th bit lost (overflow) — 255 + 1 wraps to 0
The 9th carry bit falls off the byte: overflow.

A byte holds only 8 bits. If an addition needs a ninth bit, that bit "falls off the end" and the answer is wrong — this is overflow. For example 11111111 + 00000001 (255 + 1) should be 256, but 256 needs 9 bits, so the byte wraps round to 00000000. The computer must flag this so it isn't ignored.

Binary shifts — multiply and divide by two

6 =0 0 0 0 0 1 1 012 =0 0 0 0 1 1 0 0shift left 1 = ×2  (6 × 2 = 12)
Left shift by 1 doubles: every bit slides left, a 0 fills the gap.

Sliding every bit one place left multiplies the number by 2; sliding one place right divides it by 2. Think of it like adding or removing a zero in denary (50 → 500 is ten times bigger); in binary the factor is two. New empty positions are filled with 0.

Worked example — shift 00000110 left by 1.
00000110 is 6. Every bit moves one column left, a 0 fills the gap on the right: 0000 1100 = 12. Indeed 6 × 2 = 12. ✓
Shift 00011000 (24) right by 1 → 0000 1100 = 12, and 24 ÷ 2 = 12. ✓
Common mistake: assuming right shifts never lose anything. Shifting an odd number right drops the rightmost 1, so the result is rounded down: 00000111 (7) shifted right becomes 00000011 (3), not 3.5. Division by shifting always rounds down to a whole number.

Tip: a left shift of n places multiplies by 2n (shift 3 places = ×8), and a right shift of n divides by 2n. Count the places, not the individual doublings.

Get the printable worksheet →
← Binary Numbers → Hexadecimal
← Sasta Basta home All subjects