digiwleea
The theory Tools Open the lab →

How a computer adds: binary addition, column by column

Adding two numbers is the first real thing a computer does, and it does it just like you do on paper, only in base 2. Here it is, one column at a time.

Press Next to walk through 5 + 3 and watch the carry ripple left. Then try your own numbers.

What just happened

Binary addition works exactly like the decimal addition you learned in school, with one simplification: there are only two digits. In each column you add the two bits plus any carry from the column to the right. If the total is 2 (10 in binary) or 3 (11), it does not fit in one bit, so you write the low bit and carry a 1 to the next column left. That carry is the whole trick, and it is why addition ripples from the smallest bit up to the largest.

The circuit that adds one column is a full adder: three inputs (the two bits and the carry-in), two outputs (the sum bit and the carry-out). The sum is XOR of the three inputs, and the carry-out is 1 whenever at least two inputs are 1. Wire one full adder per bit, each carry-out feeding the next carry-in, and you have a ripple-carry adder that adds whole bytes. That adder is the arithmetic heart of the ALU in every CPU, and with two's complement the same circuit subtracts too. Build it yourself from gates, which come from transistors. Once you can add, see how a computer multiplies: it turns out to be just shift and add.

Common questions

How does a computer add two numbers?

One column at a time, right to left, exactly like on paper. Each column adds three bits, the two digits plus a carry from the right, and produces a sum bit and a carry-out. The circuit for one column is a full adder; chaining them adds whole multi-bit numbers.

How does binary addition work?

Same rules as decimal, in base 2. 0 + 0 = 0, 0 + 1 = 1, and 1 + 1 = 10 (write 0, carry 1). With a carry in, 1 + 1 + 1 = 11 (write 1, carry 1). Process columns right to left, passing each carry along.

What is a full adder?

A logic circuit that adds three bits (two inputs + a carry-in), outputting a sum bit and a carry-out. The sum is A XOR B XOR Cin; the carry-out is 1 when at least two inputs are 1. One full adder does one column.

What is a ripple carry adder?

A row of full adders, one per bit, wired so each carry-out feeds the next carry-in. To add two N-bit numbers you use N full adders, and the carry ripples from the lowest bit up to the highest.

How does a computer subtract?

With the same adder, using two's complement: negate the second number (invert the bits and add 1) and add. One adder does both, which is why the ALU relies on it so heavily.

Read the theory: build a full adder from gates →

Embed this interactive

Free to embed in your course page, blog, or notes: just keep the credit link under the widget. Paste this where you want it:

<iframe src="https://digiwleea.wleeaf.dev/embed/tool/?w=add" width="100%" height="490" style="border:0;border-radius:12px;max-width:600px" title="How a computer adds" loading="lazy"></iframe>