digiwleea
The theory Tools Open the lab →

How do logic gates work?

Every computer, all of it, is built from a handful of tiny rules called logic gates. Each takes a bit or two and outputs one bit. Meet them here, and click their inputs.

Toggle the A and B inputs and watch the output lamp and truth table. Press Next gate to meet the next one.

What just happened

A logic gate is a tiny decision-maker. Its inputs are bits, either 0 (off, low voltage) or 1 (on, high voltage), and it outputs a single bit by a fixed rule you can read straight off its truth table. AND means "both", OR means "either", NOT flips, and XOR means "different". That is genuinely all a gate does, and it never changes its mind: the same inputs always give the same output.

The magic is in combining them. Wire an XOR and an AND together and you get a half adder that adds two bits. Cross-couple two NOR gates and you get a circuit that remembers a bit. Stack millions of gates and you get a CPU. And because NAND is universal (every other gate can be built from it), a chip can be etched from a single gate type. Gates themselves are built from transistors, tiny voltage-controlled switches. That is the whole ladder: switches to gates to arithmetic to a computer. Build any of it yourself in the lab.

Common questions

How do logic gates work?

Each gate takes one or two input bits (0 or 1) and outputs one bit by a fixed rule: AND = both, OR = either, NOT = flip, XOR = differ. Gates are built from transistors, and combining them builds every circuit in a computer.

What are the basic logic gates?

NOT, AND, and OR are the core, plus XOR (differ) and the inverted forms NAND and NOR. NAND and NOR are each universal: every other gate can be built from just that one type.

What is a logic gate in simple terms?

A tiny decision-maker: feed it input bits (0 = off, 1 = on) and it outputs a single 0 or 1 by a simple rule. An AND gate outputs 1 only if all inputs are 1. Stack enough of these and you get a computer.

Why is NAND called universal?

Because every other gate can be built from NAND gates alone: a NOT is a NAND with tied inputs, AND is NAND then NOT, and so on. So a chip can be made from a single gate type, one reason NAND is everywhere in real hardware.

What are logic gates used for?

Everything digital: adders and multipliers, decision logic, and, with feedback, memory. Millions to billions of gates make a CPU. Every program becomes patterns of gates switching.

Build your own gates from transistors in the lab →

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=gates" width="100%" height="500" style="border:0;border-radius:12px;max-width:600px" title="How logic gates work" loading="lazy"></iframe>