LightMySky

Adding Binary Numbers and Overflow

Adding binary numbers column by column with a carry, and what happens when the answer needs more bits than the space it has.

No account needed. Progress saves in this browser.

What a learner can do afterwards

  • Add two 8-bit binary numbers, carrying correctly
  • Spot an addition whose result no longer fits in 8 bits
  • Describe what a program shows when a value overflows

1 · Read

Binary addition uses only 0 and 1. Add the rightmost column first, then move left. When a column totals 2, write 0 and carry 1. When two input 1s and an incoming carry total 3, write 1 and carry 1.

A carry always moves one column left. For example, the carry from the ones column joins the twos column before that column is added.

add rightwrite resultcarry left
Try it together

Add 01101101 and 01011010 from right to left. The result is 11000111, which is 199 in decimal.

01101101+ 01011010= 11000111

Eight bits make 256 patterns, from 0 through 255. The number 256 needs a ninth bit, so it cannot be stored as an unsigned 8-bit value.

1 bit: 22 bits: 48 bits: 256

If a result needs a ninth bit but storage is fixed at 8 bits, the low 8 bits remain and the extra carry is discarded. This is overflow. A program may wrap to a small value, report an error, or use a larger number type.

8 bitsninth bitoverflow
Try it together

255 is 11111111 in binary. Adding 1 gives 1 00000000. If only eight result bits are kept, the leading 1 is discarded and 00000000 remains.

11111111+ 000000011 0000000000000000 kept
Try it together

For 1111 + 1, start at the right. Each 1 plus the incoming carry makes 0 and passes a carry left. The final carry creates 10000.

1 + 1carry leftcarry left10000

Add from right to left, carry into the next column, and check whether the result needs more bits.

Original lesson wording, examples, assessment items, and worked steps authored for the P12 computing curriculum.

Enrichment facts and media are adapted from the cited source records; revised cards and the other reading wording were authored for the P12 computing curriculum. The rewritten reading 'Add Bits and Carry' was written for this dataset.

2 · Watch

Take it off screen

Print a worksheetA4 with an answer key page for grown-ups. No screen, no internet.

Where it sits

Then practise

8 questions wait behind this lesson, each with its answer explained. Every answer feeds the sky: stars light as they are learned, and dim when it is time to come back.

Spotted a problem on this page? Tell us
Adding Binary Numbers and Overflow · Computing, ages 14 to 15 · LightMySky