Adding Binary Numbers

Adding two binary numbers uses the same columns as decimal addition, but each column only has the digits 0 and 1. When a column totals 2 or more, you write 0 or 1 in that place and carry 1 to the next place on the left. In this lesson you will switch bits, watch the carries move, and add the same numbers in a short C program.

Syllabus link: CAPE Computer Science Unit 1, Module 1, specific objective 4 (how data is represented, including number bases).

The place values 1, 2, 4 and 8 are the columns you add. The older notes on decimal to binary show one way to convert. You met integers in Variables, format specifiers, printf %d. Continue with Binary Representation and Manipulation for signed magnitude and two’s complement. The SR Latch lesson shows how a circuit can remember one bit.

What you will learn

  • Add unsigned binary numbers from right to left, showing every carry.
  • Explain why a column total of 2 or 3 produces a carry.
  • Distinguish the full answer from the result kept in a fixed number of bits.
  • Connect binary addition to the + operator in C and the computer’s ALU.

The addition rules for one column

Each column has three inputs: the bit from the first number, the bit from the second number, and a carry in from the place on the right. Their total is 0, 1, 2 or 3. The sum bit for this place is the remainder when that total is divided by 2. The carry out is 1 when the total is 2 or 3, and 0 otherwise. That carry out becomes the carry in for the place on the left.

A + B + carry inSum bitCarry out
000
110
201
311

Start at the rightmost place. Its carry in is always 0. Write the sum bit, pass the carry out left, and repeat. If the final carry out is 1, the sum needs one extra bit on the left.

Binary addition grid with carries shown above the columns
Figure 1. Binary addition with carries. The small digits above the columns are the carries coming from the place on the right. Phlsph7, CC0 1.0, via Wikimedia Commons.

Add two 4-bit numbers

Tap a place in A or in B to include it or leave it out. The sum bits and the carries update at once. Places from the left are 8, 4, 2 and 1. Try the stacked sum below before you read the worked example.

   1011
+  0110
  -----
      ?

Try it 1Switch the bits and add

Orange means the place is on. Grey means it is off. A is the top row, B is the bottom row. Places left to right: 8, 4, 2, 1.

Carries: none yet

0000

0


Worked example: follow the carries

1011 is 8 + 2 + 1 = 11. 0110 is 4 + 2 = 6. Add column by column from the right. The carry in to the units place is 0.

   1011
+  0110
  -----
  10001

Units place: 1 + 0 + 0 = 1. Write 1, carry out 0.

Twos place: 1 + 1 + 0 = 2. Write 0, carry out 1.

Fours place: 0 + 1 + 1 = 2. Write 0, carry out 1.

Eights place: 1 + 0 + 1 = 2. Write 0, carry out 1.

The final carry out is 1, so the full pattern is 10001. That is 16 + 1 = 17. 11 + 6 = 17. Set the top row A to 1011 and the bottom row B to 0110 on Try it 1 and confirm the sum.

168421
10001

Fixed-width check: four unsigned bits can store 0 to 15. The full answer here is 17 and needs five bits. If only the lowest four bits are kept, the stored pattern is 0001 and the final carry is lost. This is unsigned overflow; signed overflow uses a different test.

One column at a time

The rules fit in one column. Tap the three inputs. The sum bit and the carry out update. This is the step the 4-bit adder repeats from right to left.

Try it 2One column

Tap A, B or carry in to switch them. See the sum bit and the carry out for that column only.

Sum bit: 0

Carry out: 0

The same addition in C

This program adds the same two numbers in decimal. The computer still does the addition in binary inside the ALU. Type it in Code::Blocks and run it. The result matches the decimal total from Try it 1.

#include <stdio.h>

int main(void) {
    int a = 11; /* binary 1011 */
    int b = 6;  /* binary 0110 */
    int sum = a + b;
    printf("The sum is %d\n", sum);
    return 0;
}

Check yourself

Answer from the columns and the carries, not from memory of a paper. Your first try is the one that counts.

Try it 3Three questions

1. What are the four sum bits for this addition?

   1010
+  0101
  -----
      ?

2. In a column the total is 2. What do you write in that place, and what do you carry?

3. What is the decimal total, including the final carry?

   1111
+  0001
  -----
      ?

Exam tips

Write each operand on its own line, align the place values and start at the right. Show the carries and state whether your answer includes an extra carry bit. Check the full result in decimal. For practice with exam solutions, use the CS Solutions index and open the paper named in each solution. The questions here are original practice.

Practice questions

1. Add the numbers below. Show every carry. What is the decimal total?

   1101
+  0011
  -----
      ?
Show answer

Units: 1+1=0 carry 1. Twos: 0+1+1=0 carry 1. Fours: 1+0+1=0 carry 1. Eights: 1+0+1=0 carry 1. Sum 10000, which is 16. 13 + 3 = 16.

   1101
+  0011
  -----
  10000

2. A column has A=1, B=1, carry in=1. What sum bit and carry out do you produce?

Show answer

1+1+1=3. Sum bit 1, carry out 1.

3. Why does the rightmost column always start with carry in = 0?

Show answer

There is no place to the right of the units place, so nothing can carry into it.

4. In the C program, change a to 7 and b to 9. What does it print, and what are those numbers in 4-bit binary?

Show answer

It prints 16. 7 is 0111, 9 is 1001, The full binary sum needs five bits.

   0111
+  1001
  -----
  10000

Homework

Work these out on paper before using Try it 1. Keep the numbers on separate lines and show each carry.

1. Find the full sum, then state the four stored bits and the carry out.

   1101
+  1011
  -----
      ?

2. Repeat for the next pair. Explain why this answer fits into four bits.

   0101
+  0010
  -----
      ?
Check after working

1. The full answer is 11000 (24); four stored bits 1000, carry out 1.

   1101
+  1011
  -----
  11000

2. The answer is 0111 (7); carry out 0.

   0101
+  0010
  -----
   0111

Mastery quiz: Binary Addition

Your course badges: loading saved progress…

View badges

    No course badges earned yet. Score 8/10 in a lesson quiz to earn its badge.

    Saved in this browser on this device. Clearing browser data may remove your badges.

    Answer all 10 questions. Earn this lesson’s badge at 8/10 or higher. Read the explanations, revisit the Try it activities and retry as often as you need. These are self-study badges, not formal grades.

    1. Add these unsigned binary numbers.
       0101
    +  0011
      -----
          ?
    2. A column contains A = 1, B = 1 and carry in = 0. Which pair is correct?
    3. A column contains A = 1, B = 1 and carry in = 1. Which pair is correct?
    4. Find the full unsigned sum, keeping the final carry.
       1111
    +  0001
      -----
          ?
    5. For this unsigned addition, what remains in a four-bit register, and what is the carry out?
       1010
    +  1001
      -----
          ?
    6. When adding two numbers with no carry supplied from an earlier operation, why is carry in to the rightmost column 0?
    7. A student gets 1001 for this addition. What is the correct full sum?
       0111
    +  0001
      -----
          ?
    8. What does this C program print?
    int a = 6;
    int b = 5;
    printf("%d", a + b);
    9. Which unsigned addition fits in four bits without a final carry out? Work each pair in columns.
    10. Find the full sum, then give its decimal value.
       1100
    +  0110
      -----
          ?

    Next, connect the patterns to signed numbers in Binary Representation and Manipulation, or revisit Memory Types and Features to see where bits are held.

    Attributions to media used in this post:

    Phlsph7, CC0 1.0 Universal Public Domain Dedication, via Wikimedia Commons.

    Updates

    7 Nov 2026: Added the shared course badge summary and lesson mastery quiz, with feedback, retries and browser-saved progress.

    7 Nov 2026: Added a 10-question Binary Addition mastery quiz with feedback, retries and a browser-saved badge at 8/10.
    6 Nov 2026: First version. Image linked directly from Wikimedia Commons.
    6 Nov 2026: Matched the earlier CAPE CS lesson styling; stacked binary sums in aligned columns, added learning outcomes, fixed-width overflow guidance, homework and links to related lessons.

    © 2026 Vedesh Kungebeharry. All rights reserved.

    Leave a Reply