Computing Library › Classical Logic Gates
Classical Logic Gates

Half Adder

A half adder adds two single bits, producing a sum bit and a carry bit, but accepts no carry in.

What it does

A half adder adds two one-bit numbers, A and B. It produces a sum bit and a carry bit. It is called half because it has no input for a carry coming from a lower position, which limits how it can be chained.

Truth table

ABCARRYSUM
0000
0101
1001
1110

The gate equations

In code

python

def half_adder(a, b):
    s = a ^ b     # sum bit
    c = a & b     # carry bit
    return s, c

Why it is not enough alone

Adding multi-bit numbers requires propagating a carry from each position into the next. A half adder cannot accept that incoming carry, so only the least significant bit of an unsigned addition can use one directly. Every other position needs a full adder.

Its place in arithmetic

Despite the limitation, the half adder is the conceptual seed of all binary arithmetic. A full adder is built from two half adders plus an OR gate, and ripple or carry-lookahead adders are chains of full adders. Understanding the half adder makes the rest follow naturally.