Addition is a * fundamental arithmetic operation*. Of course, it is no different in binary, and adding binary numbers is one of the most common operations we will perform.

Fortunately, they are not very different from their decimal counterparts. In fact, in binary, it is even simpler. We will simply **add digit by digit from right to left**, considering carryovers.

It is also important that if we are working with fixed-size binary numbers, we consider overflow and underflow.

## Binary Addition

* Binary addition* is a basic operation in the binary system. It is similar to addition in the decimal system, but it is performed with only two digits

`0`

and `1`

.The summary of the process is as follows:

- Start by adding the bits from the right and continue to the left
- If the sum of two bits is
`1`

or`0`

, write the result below the bits and continue - If the sum is 2, then write a
`0`

and carry over a`1`

to the next higher bit

### Carry

In addition, a “carry” occurs when **the sum of two digits produces a result greater than or equal to the base**, so it needs to be “carried” to the next position.

In binary, this **only occurs when both bits we are adding are 1**, in which case the sum is equal to ’

`2`

.In this case, the result is `0`

and the carry means adding 1 to the next most significant bit.

### Example of Binary Addition

For example, to add the binary numbers `1011`

(11 in decimal) and `1101`

(13 in decimal)

```
1011
+ 1101
______
11000
```

The result is `11000`

, which is equal to 25 in decimal.

```
10101
+ 11
______
11000
```

## How to Add Quickly in Binary

Adding in binary is quite simple. However, binary numbers are generally very long, so it can become… tedious.

Typically, it is not an operation you would have to do by hand. But, if you ever have to do it, usually because your teacher wants you to, know that * there are very quick ways to perform addition*.

In fact, **it is super easy and very fast to add binary numbers**. Let’s start by analyzing what we will encounter. First, let’s assume we are not carrying over.

- If both are
`0`

, the result is`0`

- If one is
`0`

and the other`1`

(or vice versa), they “mesh,” and make a`1`

- The only difficult case is when we have
`1`

and`1`

, where we have a carry.

Now, let’s see what happens when we do have a carry.

Here, the interesting part is to see that, when we have a carry, all combinations overflow, except for `0`

with `0`

.

That is, once the carry is “activated,” the `1`

that we carry cannot drop down until it finds `0`

and `0`

.

## Example

Let’s see it with an example. Suppose we want to add these two 12-bit binary numbers.

We start from the right and look for combinations of `1`

with `1`

. This is where the carry will be activated.

Next, we keep searching until we find a `0`

with `0`

. That’s where the carry can drop down.

In the end, it’s as if the `1-1`

generates a `10`

. The `0`

stays in place, and the `1`

goes and goes until it finds a `0-0`

where it can drop down.

Now, we simply need to fill in the blocks we have defined. In the blocks without carry, we apply the normal rules.

`0-0`

adds to`0`

`0-1`

or`1-0`

, mesh with each other, and give`1`

Or, in other words, in the blocks without carry, “the `1`

s rule.”

Now we reach the next block, which is with carry. Here “the `0`

s rule.” If there is a `0`

in the bits we are adding, the result is `0`

. If not, it is `1`

.

And we would continue alternating between blocks with carry and blocks without carry until we run out of numbers.

Finally, you can also see it as the blocks without carry being XOR, and those with carry being NXOR.

This is less practical for operating, but it allows you to use the mnemonic from Hamlet “To Be or Not To Be,” so that many years from now you will still remember that binary addition is done in XOR and NXOR blocks:

## Bonus: How to Quickly Add 1 in Binary

Special bonus, * how to quickly add 1 to a binary number*. A very simple operation, but since it is very common, it is good to know how to do it.

Fortunately, adding 1 in binary is “easy.” Simply

- Traverse the binary number from the right
- Look for the first
`0`

you find, and change it to`1`

- From that position, to the right, all
`0`

s.

For example, if we had to add 1 to `1000011111`

We look for the first `0`

We change it to `1`

and, from there to the right, all `0`

.

So the result is `1000100000`

. As you can see, adding one is super quick.