Binary addition
Binary addition works one position at a time, from the right.
Two bits with the value 1 give 0 at that position and a carry into the next position.
The value 1010 plus 0011 gives 1101, which is 13.
Try binary addition in the bit editor
The sum of 1010 and 0011. Edit the expression or select a bit to flip it.
7
6
5
4
3
2
1
0
13
value · 8 bits · unsigned
- binary
- 0b00001101
Bit width
The result of one column of an addition
| A | B | Carry in | Sum bit | Carry out |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 1 | 1 |
| 1 | 0 | 1 | 0 | 1 |
Where binary addition is used
A processor holds one adder circuit, and a subtraction runs through it as an addition.
An overflow of a counter follows the same rule: the carry out of the top bit disappears.
A checksum adds bytes and drops the carry, so the result stays in one byte.
Binary addition: points to note
- A carry out of the top bit does not fit. At a bit width of 8, 200 plus 100 gives 44.
- A signed overflow gives a wrong sign. At a bit width of 8, 100 plus 100 gives -56.
- Beetwise widens the bit width to hold the true sum, so set the width to see the overflow.
- An XOR is an addition without any carry.
The full bit editor
The full editor holds many values, evaluates expressions across them, and reads live values from a serial port.
Open this value in the full editorQuestions about binary addition
- What is 1010 plus 0011 in binary?
- The sum is 1101, which is 13 in decimal.
- What happens on an overflow?
- The carry out of the top bit disappears, so the result wraps. At a bit width of 8, 255 plus 1 gives 0.
- How does a processor subtract?
- It adds the two’s complement of the second value, so one adder circuit covers both operations.