Browse lessons

Build a half adder

Add two one-bit inputs with XOR and AND gates.

Add two bits

A half adder takes two inputs, A and B, and produces two outputs: Sum and Carry.

XOR calculates the sum bit. AND calculates the carry bit.

Try the circuit

Try 0 + 1, then 1 + 1. When both inputs are 1, Sum is 0 and Carry is 1.

Click an input to change its value.Sum: 0 · Carry: 0

Read the result as Carry, Sum. For 1 + 1, those bits are 10, the binary representation of two.

ABCarrySum
0000
0101
1001
1110

Build it in the editor

  1. Place two Toggle Switch components, an XOR gate, an AND gate, and two Output components.
  2. Connect both switches to the XOR gate.
  3. Connect the same switches to the AND gate.
  4. Connect each gate to its own output.

The XOR output is Sum; the AND output is Carry. Both gates receive the same two input values.

Add a carry input

A half adder has no input for a carry from a previous bit. A full adder adds that third input, which lets several adders work together.