Skip to content
## Introduction

## How to Add Two Binary Numbers

## How to Add Two Binary Numbers

## How to Add Two Binary Numbers

## Worked Example 1

## Worked Example 1

## Worked Example 1

## Worked Example 1

## Worked Example 2

## Worked Example 2

## Worked Example 2

## Worked Example 3

## Worked Example 3

## Overflow Errors

## Overflow Errors

## Overflow Errors

## Lesson Summary

Even when a decimal number is converted to binary, we can still perform mathematics on it as if it were a decimal number.

One mathematical operation is simple addition, where we can add two numbers and get a result.

However, sometimes, the answer’s result can be too big for our number of bits, and this is called an overflow.

In this lesson, we’ll learn about:

- How to add two binary numbers together.
- What overflow errors are and how to they occur.

This is the one piece of math that you need to be able to do for the exam. You will not have access to a calculator.

Let’s take some simple addition in normal decimal notation.

Say we wanted to add the numbers 28 and 46.

1000 | 100 | 10 | 1 | |
---|---|---|---|---|

Number 1 |
2 | 8 | ||

Number 2 |
4 | 6 | ||

Result |

Let’s work through this simple addition step-by-step:

We take the first column – add the 8 and the 6, giving us 14 – which means we store 4 in the ‘1’s column and carry over 1.

1000 | 100 | 10 | 1 | |
---|---|---|---|---|

Number 1 |
2 | 8 | ||

Number 2 |
4 | 6 | ||

Result |
0 | 4 | ||

Carry |
1 |

Then add up the tens column, including the carry, which gives us the decimal value 74.

1000 | 100 | 10 | 1 | |
---|---|---|---|---|

Number 1 |
2 | 8 | ||

Number 2 |
4 | 6 | ||

Result |
7 | 4 | ||

Carry |
1 |

I am sure you’re very familiar with this sort of decimal addition.

In order to add two __ binary__ numbers together, you need to learn the rules of binary addition. These are:

- 0 + 0 = 0
- 0 + 1 = 1
- 1 + 0 = 1
- 1 + 1 = 10 (0 carry 1)
- 1 + 1 + 1 = 11 (1 carry 1)

Let’s try using this to add two numbers in binary.

Let’s try adding 101 and 101.

Now 101 is the number 5, so 5 + 5 should equal 10.

10 in binary is 1010.

Let’s see if knowing the answer means we can work it out correctly.

128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | |
---|---|---|---|---|---|---|---|---|

Num 1 |
0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 |

Num 2 |
0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 |

Result |
||||||||

Carry |

Just like with the decimal addition, we’ll work through this step-by-step.

**Step 1**

Let’s start by looking at the 1’s column. 1+1 gives us 0 carry 1.

128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | |
---|---|---|---|---|---|---|---|---|

Num 1 |
0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 |

Num 2 |
0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 |

Result |
0 | |||||||

Carry |
1 |

**Step 2**

Now, let’s look at the 2’s column. 0 + 0 + 1 = 1, with nothing to carry.

128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | |
---|---|---|---|---|---|---|---|---|

Num 1 |
0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 |

Num 2 |
0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 |

Result |
1 | 0 | ||||||

Carry |
1 |

**Step 3**

Let’s now look at the 4’s column. 1 + 1 = 0, carry 1.

128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | |
---|---|---|---|---|---|---|---|---|

Num 1 |
0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 |

Num 2 |
0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 |

Result |
0 | 1 | 0 | |||||

Carry |
1 | 1 |

**Step 4**

Finally, we look at the 8’s column. 0 + 0 + 1 = 1, with nothing to carry.

128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | |
---|---|---|---|---|---|---|---|---|

Num 1 |
0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 |

Num 2 |
0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 |

Result |
1 | 0 | 1 | 0 | ||||

Carry |
1 | 1 |

You can see that this has given us a final number of 1010.

128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | |
---|---|---|---|---|---|---|---|---|

Num 1 |
0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 |

Num 2 |
0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 |

Result |
1 | 0 | 1 | 0 | ||||

Carry |
1 | 1 |

1010, if converted to decimal, is 10. The correct answer!

Let’s say we wanted to add 111 and 111.

111 is 7, so 7 + 7 should equal 14, which is 1110 in binary.

**Step 1 **

Let’s start with the 1’s column. 1 + 1 = 0, carry 1.

128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | |
---|---|---|---|---|---|---|---|---|

Num 1 |
0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 |

Num 2 |
0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 |

Result |
0 | |||||||

Carry |
1 |

**Step 2 **

Now, let’s look at the 2’s column. 1 + 1 + 1 = 1, carry 1.

128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | |
---|---|---|---|---|---|---|---|---|

Num 1 |
0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 |

Num 2 |
0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 |

Result |
1 | 0 | ||||||

Carry |
1 | 1 |

**Step 3 **

Let’s now look at the 4’s column. 1 + 1 + 1 = 1, carry the 1.

128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | |
---|---|---|---|---|---|---|---|---|

Num 1 |
0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 |

Num 2 |
0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 |

Result |
1 | 1 | 0 | |||||

Carry |
1 | 1 | 1 |

**Step 4 **

Finally, we look at the 8’s column. 0 + 0 + 1 = 1, with nothing to carry.

128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | |
---|---|---|---|---|---|---|---|---|

Num 1 |
0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 |

Num 2 |
0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 |

Result |
1 | 1 | 1 | 0 | ||||

Carry |
1 | 1 | 1 |

This gives us a final number of 1110.

1110, if converted to decimal, is 14. The correct answer!

Another way to check your work is to convert your binary numbers to decimals, add them, and then convert your answer back again.

Say you wanted to add two numbers, 1011 and 1001.

The first thing you do is find the decimal values of these two binary numbers:

The decimal value of 1011 is 11 (8+2+1).

8 | 4 | 2 | 1 |
---|---|---|---|

1 | 0 | 1 | 1 |

The decimal value of 1001 is 9 (8+1).

8 | 4 | 2 | 1 |
---|---|---|---|

1 | 0 | 0 | 1 |

In the decimal world, 11 + 9 = 20.

Now, all we have to do is convert the decimal number 20 back into binary.

128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
---|---|---|---|---|---|---|---|

0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 |

So there you have it! 1011 + 1001 = 10100.

Let’s assume we want to add two 4-bit binary numbers together – 1001 and 1001 (or 9 and 9 in decimal).

**Step 1 – **Let’s start by looking at the 1’s column.

8 | 4 | 2 | 1 | |
---|---|---|---|---|

Number 1 |
1 | 0 | 0 | 1 |

Number 2 |
1 | 0 | 0 | 1 |

Result |
0 | |||

Carry |
1 |

**Step 2 –** Now let’s look at the 2’s column.

8 | 4 | 2 | 1 | |
---|---|---|---|---|

Number 1 |
1 | 0 | 0 | 1 |

Number 2 |
1 | 0 | 0 | 1 |

Result |
1 | 0 | ||

Carry |
1 |

**Step 3 –** Let’s now look at the 4’s column.

8 | 4 | 2 | 1 | |
---|---|---|---|---|

Number 1 |
1 | 0 | 0 | 1 |

Number 2 |
1 | 0 | 0 | 1 |

Result |
0 | 1 | 0 | |

Carry |
1 |

**Step 4 – **Finally, we look at the 8’s column…

8 | 4 | 2 | 1 | |
---|---|---|---|---|

Number 1 |
1 | 0 | 0 | 1 |

Number 2 |
1 | 0 | 0 | 1 |

Result |
0 | 0 | 1 | 0 |

Carry |
1 |

… and there’s 1 to carry over, but now we have a situation called an **OVERFLOW**.

The resulting binary number needs more bits to store it than the original two numbers.

The actual result of adding 9 + 9 would give us 18, which in binary would look like this:

16 | 8 | 4 | 2 | 1 | |
---|---|---|---|---|---|

Number 1 |
1 | 0 | 0 | 1 | |

Number 2 |
1 | 0 | 0 | 1 | |

Result |
1 | 0 | 0 | 1 | 0 |

Carry |
1 | 1 |

Do you see how the product of the addition needs an extra bit to store the information? This is called an **OVERFLOW ERROR**.

This means that the number of bits required to store your answer is bigger than the number of bits allocated.

Even when a decimal number is converted to binary, we can still do any mathematics on them as if they were decimal numbers.

To add two binary numbers together, you need to learn the rules of binary addition.

- 0 + 0 = 0
- 0 + 1 = 1
- 1 + 0 = 1
- 1 + 1 = 10 (0 carry 1)
- 1 + 1 + 1 = 11 (1 carry 1)

If the number of bits required to store the answer is bigger than the number of bits allocated, then this is an overflow error.