Study Guide

Binary Addition and Overflow

How to add two 8-bit binary numbers column by column with carries, and why an 8-bit register gives a wrong answer when the true result is greater than 255.

Lesson 1.3 Data Representation

For: Cambridge IGCSE Computer Science learners, or anyone who can already convert between binary and denary

Stage: Think

Adding on paper

A school tuckshop till adds up two lots of takings in pence: 58 and 67. (The school and its till are fictional.) You are going to add them in columns, the way you were taught at primary school.

Think it through

Add 58 and 67 in columns, starting from the right. What do you do when the ones column adds up to more than 9, and what do you do in the tens column afterwards?

Show what happens

In the ones column 8 + 7 = 15: write the 5 and carry the 1 into the tens column. In the tens column 5 + 6 + the carried 1 = 12: write the 2 and carry the 1 into the hundreds column. The answer is 125. A column that adds up to more than one digit can hold writes the last digit and carries the rest to the next column on its left.

Stage: Discover

One column in binary

Binary addition follows exactly the same plan, with a smaller set of digits: a column can only write 0 or 1.

Think it through

In one binary column, what would you write for 1 + 1, given that the digit 2 does not exist? What would you do with the rest?

Show what happens

1 + 1 = 2, and two in binary is 10: a 1 in the twos column and a 0 in the ones column. So the column writes 0 and carries 1 into the next column on the left, where each unit is worth two.

A column in the middle of a sum adds up to three things: the bit from the first number, the bit from the second number and any carry in from the column to its right. Each is 0 or 1, so the column total is 0, 1, 2 or 3. In each case, write the part that fits in one binary digit and carry the rest:

Column totalIn binaryWriteCarry to the next column
0000
1110
21001
31111

Do not memorise this table: for any total, the digit written is the right-hand digit of its binary form, and the carry is the left-hand digit.

Check your understanding

In one column the two bits are 1 and 1, and a carry of 1 comes in from the right. What does the column write, and what does it carry?
Show the answer

Answer: B. Write 1 and carry 1, because the total is 3, which is 11 in binary.

The total is 1 + 1 + 1 = 3, which is 11 in binary. A column holds one digit, so it writes 1 and carries 1.

Stage: Explain

Adding two 8-bit numbers

Think it through

Add 00000101 and 00000011 column by column, starting from the right. Then check your answer by converting all three numbers to denary.

Show a model answer

Column by column from the right: 1 + 1 = 2, write 0 and carry 1. Next 0 + 1 + 1 = 2, write 0 and carry 1. Next 1 + 0 + 1 = 2, write 0 and carry 1. Next 0 + 0 + 1 = 1, write 1 and carry nothing. The rest are 0. The answer is 00001000. Check: 5 + 3 = 8, and 00001000 is 8.

First the two numbers in denary, so that the answer can be checked: 00101101 is 32 + 8 + 4 + 1 = 45, and 00011011 is 16 + 8 + 2 + 1 = 27. The answer should be 72.

Call the first number A and the second number B. The table works from the right-hand column (the 1s) to the left, which is the order of the working. The Answer column, read from the bottom to the top, is the answer.

ColumnABCarry inAnswer
1s1100
2s0110
4s1010
8s1111
16s0110
32s1010
64s0011
128s0000
  1. Start at the right, because carries move left. In the ones column, 1 + 1 = 2: write 0, carry 1.
  2. Add the carry into the next column. In the twos column, 0 + 1 + 1 (carry) = 2: write 0, carry 1.
  3. Keep going. The fours column is 1 + 0 + 1 = 2: write 0, carry 1. The eights column is 1 + 1 + 1 = 3: write 1, carry 1. The sixteens column is 0 + 1 + 1 = 2: write 0, carry 1. The thirty-twos column is 1 + 0 + 1 = 2: write 0, carry 1.
  4. Finish at the left. The sixty-fours column is 0 + 0 + 1 = 1: write 1, carry nothing. The 128s column is 0 + 0 + 0 = 0.
  5. Read the answer and check it. The answer is 01001000, which is 64 + 8 = 72. That matches 45 + 27.

Now try one with the first rows done for you. Add A = 0110 1011 (107 in denary) and B = 0011 0110 (54 in denary), one column at a time, from the right. The answer should be 161.

Adding 0110 1011 and 0011 0110, one column at a time
ColumnBit of ABit of BCarry inTotalWriteCarry out
1s100110
2s110201
4s011201
8s101
16s011
32s111
64s101
128s001

    Show the completed table
    ColumnBit of ABit of BCarry inTotalWriteCarry out
    1s100110
    2s110201
    4s011201
    8s101201
    16s011201
    32s111311
    64s101201
    128s001110

    Check your understanding

    Which statement about the finished table is correct?
    Show the answer

    Answer: A. Read from the bottom (128s) to the top, the Write column gives 10100001, which is 161 and matches 107 + 54.

    The bits are written 1, 0, 1, 0, 0, 0, 0, 1 from the 128s column to the 1s column: 10100001 = 128 + 32 + 1 = 161. And 107 + 54 = 161. The last column totalled only 1, so nothing was carried past it.

    Stage: Experiment

    Adding on your own

    Now add without the column table. Work from the right, write each carry above the next column, and check each answer in denary.

    Add each pair of 8-bit numbers
    First numberSecond numberAnswer
    0000 11010000 0111
    0101 01010010 1010
    1001 01100100 0011
    0011 11110000 0001

      Show the completed table
      First numberSecond numberAnswer
      0000 11010000 01110001 0100
      0101 01010010 10100111 1111
      1001 01100100 00111101 1001
      0011 11110000 00010100 0000

      Check your understanding

      Which of these is 0110 0011 + 0010 0101?
      Show the answer

      Answer: C. 1000 1000, which is 136, matching 99 + 37.

      0110 0011 is 99 and 0010 0101 is 37. Column by column the sum is 1000 1000, which is 128 + 8 = 136 = 99 + 37.

      Stage: Think

      A counter that runs out

      A fictional toy car has a mileage counter made of three wheels, so it can show 000 to 999. The counter shows 998 and the car drives 5 more miles.

      Think it through

      What does the counter show after the 5 miles? Is it showing the right distance, and what has gone wrong?

      Show what happens

      It shows 003. The true answer, 1003, has four digits, but the counter has only three wheels, so the leading 1 has nowhere to go and is lost. The counter shows a wrong answer without any warning.

      Stage: Explain

      Overflow in an 8-bit register

      Inside a processor, numbers are held in a register: a small store with a fixed number of bits. An 8-bit register has exactly eight columns, worth 128, 64, 32, 16, 8, 4, 2 and 1. With every bit on it holds 255, and it has no column for 256.

      If an addition makes a result greater than 255, the carry out of the leftmost column has nowhere to go. This is overflow: the register size limits the value that can be stored, so the answer held is wrong.

      200 is 1100 1000 (128 + 64 + 8) and 100 is 0110 0100 (64 + 32 + 4). The true answer is 300, which is more than 255.

      Calling the numbers A and B again, the table works from the 1s column to the left. The register has no 256s column: the last row is shown only to see where the carry goes.

      ColumnABCarry inAnswer
      1s0000
      2s0000
      4s0101
      8s1001
      16s0000
      32s0101
      64s1100
      128s1010
      256s––11, lost
      1. Add as before, from the right. The 1s column is 0 + 0 = 0 and the 2s column is 0 + 0 = 0. The 4s column is 0 + 1 = 1, the 8s column is 1 + 0 = 1, the 16s column is 0 + 0 = 0 and the 32s column is 0 + 1 = 1. None of these carries anything.
      2. Reach the 64s column. 1 + 1 = 2: write 0, carry 1.
      3. Reach the 128s column. 1 + 0 + 1 (carry) = 2: write 0, carry 1. This carry belongs in a 256s column, but the register has no ninth bit, so it is lost.
      4. Read what the register keeps. The register holds 0010 1100, which is 32 + 8 + 4 = 44, not 300. The lost carry was worth 256, and 300 − 256 = 44.

      A 1 in the leftmost bit is not overflow. 1100 1000 starts with a 1, and it is a perfectly good 200. Overflow means the true result is greater than 255, so that it needs a ninth bit.

      Check your understanding

      Which of these additions causes overflow in an 8-bit register?
      Show the answer

      Answer: A. 128 + 129, because the answer is 257.

      200 + 55 = 255 and 100 + 100 = 200 both fit in eight bits. 128 + 129 = 257 does not, so it overflows, and the register would hold 257 − 256 = 1.

      Stage: Apply

      Use it somewhere new

      Apply it

      Priya adds 0110 0100 and 0110 0100 in an 8-bit register and gets 1100 1000. She says: “The answer starts with a 1, so it has overflowed.” What is wrong with her reasoning?
      Show the answer

      Answer: B. The answer is 200, which fits; overflow needs a result above 255.

      0110 0100 is 100, and 100 + 100 = 200. The answer 1100 1000 is 200, which fits in eight bits, so there is no overflow. A leading 1 only says that the 128s column is on.

      A fictional game keeps a player’s coins in an 8-bit register. The player has 250 coins and collects 10 more.

      Apply it

      What does the register hold afterwards, assuming the game does nothing to handle overflow?
      Show the answer

      Answer: D. 4, because 260 is 256 more than 4 and the extra 256 is lost.

      250 is 1111 1010 and 10 is 0000 1010. Their sum is 1 0000 0100: the leading 1 is the lost 256, and the register holds 0000 0100, which is 4. The coins have wrapped round, so the player appears to have 4.

      Complete the table: add each pair in an 8-bit register, write what the register holds, and say whether the addition overflows.

      What an 8-bit register holds after each addition
      First numberSecond numberRegister holdsOverflow? (Yes or No)
      0100 11000010 0110
      1011 01100100 1010
      1111 00000001 0001
      1001 00010110 1110

        Show the completed table
        First numberSecond numberRegister holdsOverflow? (Yes or No)
        0100 11000010 01100111 0010No
        1011 01100100 10100000 0000Yes
        1111 00000001 00010000 0001Yes
        1001 00010110 11101111 1111No

        Stage: Consolidate

        Bring it together

        Think it through

        Without looking back, explain to a friend what overflow is and why it happens in an 8-bit register, using an example of your own.

        Show a model answer

        A good answer says that a register has a fixed number of bits, so an 8-bit register can hold only 0 to 255. If an addition produces a result greater than 255, it needs a ninth bit that the register does not have, so the carry is lost and the value stored is wrong. For example, 255 + 1 = 256 would need nine bits, and the register would hold 0000 0000.

        Check your understanding

        A fictional museum’s turnstile counts visitors in an 8-bit register that holds 1111 1111. Another visitor comes in and 1 is added. What happens?
        Show the answer

        Answer: B. The register holds 0000 0000, and overflow has happened.

        1111 1111 + 0000 0001 gives a carry that runs through every column and leaves a 1 beyond the leftmost one. That 1 is lost, so the register holds 0000 0000 even though 256 visitors have entered.

        • To add binary numbers, work from the right, one column at a time. Each column totals the two bits and any carry in: a total of 0 or 1 is written as it is, 2 writes 0 and carries 1, and 3 writes 1 and carries 1.
        • Check an addition by converting both numbers and the answer to denary.
        • A register holds a fixed number of bits. An 8-bit register holds 0 to 255.
        • Overflow happens when an addition produces a value greater than 255 in an 8-bit register: the carry out of the leftmost column has nowhere to go and is lost, so the stored result is wrong (the true answer less 256).
        • A leading 1 does not mean overflow. Compare the true result with 255.

        Sources and scope

        • What this lesson is. The third lesson of the Data Representation module, written for this site. It teaches point 4 of Cambridge IGCSE Computer Science 1.1 (adding two positive 8-bit integers, and overflow) against the 2026 to 2028 syllabus (version 6). Its curriculum links are provisional: no link has been verified by the site owner. They show where the lesson may help with a course and imply no review or endorsement by any examination board.
        • Original material. The school tuckshop, the three-wheel toy car, Priya, the coin game and the museum turnstile are fictional examples written for this lesson.
        • Simplified on purpose. Only positive integers are added, and an overflowed result is shown as the register would hold it, with the lost carry discarded. Real programs and processors may detect an overflow and report an error, use a larger register (16, 32 or 64 bits), or limit a value at its maximum instead. Negative numbers and subtraction are not taught here.