What Is a Boolean Algebra and How Is It Used in Computing?

Every computer you've ever touched runs on an algebra with exactly two numbers: 0 and 1. Here's how three simple operations, wired together in patterns, add numbers, make decisions, and run everything from your phone to the internet.

By Petrus Sheya

August 7, 2026 · 6 min read

How does a lump of sand know how to run a video game?

That sounds like a joke, but it's the real question. A computer chip is just silicon, metal, and a huge number of tiny switches. No number is stored anywhere as "7" or "42." Everything the chip does comes down to switches being on or off. Nothing else exists inside a processor.

That's the whole idea behind Boolean algebra: an algebra with exactly two values, and a handful of rules for combining them. Learn those rules, and you understand the logic that every computer, phone, and website is built on.


The only two numbers that exist here

In ordinary algebra you work with an infinite number line. Boolean algebra throws almost all of it away. There are only two values: 0 and 1. Or, if you'd rather: false and true, off and on.

That's not a limitation. It's the whole trick. A transistor, the tiny switch inside every chip, only needs to answer one question: is current flowing through it or not? Two states. That's a bit, short for "binary digit," and it's the smallest unit of information a computer can hold.

Every number, every image, every word you're reading right now, gets built out of millions of these two-state switches, wired together in patterns.

Flip the two switches and pick a gate. Every digital decision your computer makes is one of these six functions, applied billions of times a second.

ABAND0OUTABAND000010100111
A1
B0
AND(A, B)0

Flip switch A. Flip switch B. Watch how the same two switches produce a different answer depending on which gate you pick. AND only lights up when both switches are on. OR lights up if either one is. XOR lights up only when they disagree. Three simple rules, and you've already covered most of what a chip actually does.


Switches in series, switches in parallel

Here's a way to feel these operations instead of just reading them off a table. Picture two light switches wired to one lamp.

Wire the switches in series, one after another along the same wire, and the lamp only turns on when both switches are closed. That's AND. Break the circuit at either switch and the current stops.

Wire the switches in parallel, two separate paths to the same lamp, and the lamp turns on if either switch is closed. That's OR. Current just needs one open path. It doesn't care which.

And NOT? That's a switch wired backwards. Closing it breaks the circuit instead of completing it.

We write these three operations with symbols: ABA \land B for AND, ABA \lor B for OR, and ¬A\lnot A for NOT. XOR, "exclusive or," gets its own symbol too: ABA \oplus B. It's true only when AA and BB disagree, exactly what you'd want if you were building a light that turns on when exactly one of two doors is open.


Wiring an expression into an actual circuit

Once you have AND, OR, and NOT, you can write more complicated statements the same way you'd write ordinary algebra. Something like:

(AB)¬C(A \land B) \lor \lnot C

That expression says: true if A and B are both true, or if C is false. But here's the part that might surprise you: this expression isn't just a sentence. It's a literal blueprint for a circuit. Every AND, OR, and NOT becomes a physical gate, and every variable becomes a wire.

This circuit wires up (A AND B) OR (NOT C). Toggle any switch and watch the signal actually travel through the gates.

ABCANDNOTOR0OUT
A AND B0
NOT C0
Result0

Toggle A, B, and C and watch the signal travel through the gates. Each wire lights up green when it's carrying a 1 and stays dim when it's carrying a 0. The AND gate only passes a 1 through when both of its inputs are lit. The final lamp is just the OR of whatever comes out of the two gates before it.

This is, quite literally, how a circuit designer turns a logical requirement into hardware. Write the boolean expression, then wire up the matching gates.


Two circuits that look different but are secretly the same

Here's a claim worth doubting at first: ¬(AB)\lnot(A \land B) and (¬A)(¬B)(\lnot A) \lor (\lnot B) are the exact same function. Not similar. Identical, for every possible input.

This is one of De Morgan's laws, and it's genuinely useful. It lets you rewrite a circuit built from one kind of gate using a completely different kind, which matters a lot when you're manufacturing chips and some gates are cheaper to build than others.

AB=¬A¬B\overline{A \land B} = \lnot A \lor \lnot B AB=¬A¬B\overline{A \lor B} = \lnot A \land \lnot B

Don't take our word for it. Watch both circuits run through every possible input.

Two different-looking circuits, run on all four possible inputs. Watch both lamps agree every single time.

NOT(A AND B)1(NOT A) OR (NOT B)1
Input (A, B)(0, 0)
Left lamp1
Right lamp1
StatusMATCH

Hit play and watch all four rows cycle through: (0,0), (0,1), (1,0), (1,1). Every single time, both lamps match. That's what "identical function" actually means: not that the circuits look alike, but that no input you could ever feed them would tell them apart.


From logic to arithmetic: how a chip adds two numbers

Here's where this stops being an abstract puzzle and starts being the reason your phone can do math. Addition, the kind you learned in first grade, can be built entirely out of AND, OR, and XOR gates.

Take the simplest case: adding two single bits, AA and BB. There are two things you need to know: what's the sum, and did it carry over?

XOR gives you the sum digit (11=01 \oplus 1 = 0, with a carry). AND gives you the carry bit (11=11 \land 1 = 1). Put them side by side and you've built what's called a half adder.

A half adder: XOR computes the sum bit, AND computes the carry bit. This pair is the core building block of every CPU's arithmetic unit.

ABXOR (SUM)0SAND (CARRY)1C
A + B (decimal)1 + 1 = 2
Sum bit0
Carry bit1
Binary result10

Toggle A and B and watch both bits update. When both switches are on, the sum bit drops to 0 and the carry bit lights up, exactly like adding 1+1=101 + 1 = 10 in binary: write down 0, carry the 1.

Chain enough of these together, add a bit for carrying in from the previous column, and you've built the same kind of adder circuit sitting inside your phone's processor right now, adding numbers billions of times a second.


The short version

Boolean algebra is arithmetic with only two values, 0 and 1, and three basic operations: AND, OR, and NOT. Every one of those operations has a physical shape: a transistor circuit wired in series, in parallel, or backwards. Chain gates together and you can build any logical expression you can write down. Some circuits that look different turn out to compute the exact same function, which is what lets engineers redesign hardware without changing its behavior. And once you have XOR and AND working together, you already have the two gates that make up computer arithmetic.

Every video you stream, every search you run, every game you play is, underneath everything else, a colossal number of switches flipping between 0 and 1, wired together exactly the way we just walked through.


All visualizations are interactive React components running entirely in your browser. Every logic gate is drawn from scratch in SVG and evaluated live from your switch positions. No libraries beyond React.