GCSE Revision

Binary numbers

Binary place values

We count in denary (base 10), with digits 0–9 and place values of 1, 10, 100 and so on. Computers use binary (base 2), with only the digits 0 and 1. Each place is worth double the one to its right:

1286432168421

With 8 bits, the smallest number is 00000000 (0) and the biggest is 11111111 (255). The left-hand bit, worth 128, is the most significant bit (MSB); the right-hand bit, worth 1, is the least significant bit (LSB).

A binary number can have fewer than 8 bits: 11010 is the same as 00011010, just as 042 is the same as 42.

Key terms

Binary to denary

Write the number under the place values, then add up the place values that have a 1.

Example: convert 10110101 to denary.

1286432168421
10110101

128 + 32 + 16 + 4 + 1 = 181

Denary to binary

Work from the left. For each place value, ask: does it fit into what's left? If it does, write 1 and take it away; if not, write 0.

Example: convert 99 to binary.

  1. 128 doesn't fit into 99: 0
  2. 64 fits: 1, leaving 35
  3. 32 fits: 1, leaving 3
  4. 16, 8 and 4 don't fit into 3: 0, 0, 0
  5. 2 fits: 1, leaving 1
  6. 1 fits: 1, leaving 0
1286432168421
01100011

So 99 is 01100011. Check: 64 + 32 + 2 + 1 = 99.

Adding binary numbers

Add from the right, column by column, just like denary addition, using these rules:

SumWriteCarry
0 + 000
0 + 110
1 + 101
1 + 1 + 111

Example: 01011010 (90) + 00111001 (57)

1286432168421
01011010
+00111001
Carry1111
=10010011

The answer is 10010011, which is 147. Check in denary: 90 + 57 = 147.

Exam tip

Write your carries in: they can earn marks even if you slip up later.

Overflow

An 8-bit number can't be bigger than 255. If the answer to an addition needs a 9th bit, there's nowhere to store it, so it's lost. This is an overflow error, and it gives a wrong answer.

Example: 11001000 (200) + 01100100 (100)

(256)1286432168421
11001000
+01100100
Carry11
=100101100

The answer, 300, needs 9 bits: 100101100. There is no 256 place to store the 9th bit, so only the last 8 bits are kept, 00101100, which is 44, not 300.

Key terms

Binary shifts

A binary shift moves every bit left or right by a number of places, filling the gaps with 0s.

  • Left shift: each place multiplies the number by 2. A left shift of 2 places multiplies by 4.
  • Right shift: each place divides the number by 2. Bits that fall off the right-hand end are lost, so the answer is rounded down.

Example: 00010110 is 22.

ShiftResultDenary
None0001011022
Left 2 places0101100088 (22 × 4)
Right 2 places000001015 (22 ÷ 4 = 5.5, rounded down)

Common mistake

A left shift can push 1s off the left-hand end too. 11000000 (192) shifted left 1 place gives 10000000 (128), not 384.

Key terms

Take the quiz