Ad Space
AND Output 0

A AND B = 0

Truth Table

ABOutput
Ad Space

How Logic Gates Work

A logic gate takes one or two binary inputs — each either 0 (false/off) or 1 (true/on) — and produces a single binary output according to a fixed rule. Every digital circuit, from a simple alarm system to a full CPU, is built by wiring together enormous numbers of these same basic gates.

The Seven Gates This Calculator Covers

AND outputs 1 only when both inputs are 1 — think of it as requiring every condition to be true at once. OR outputs 1 when at least one input is 1. NOT is the simplest gate of all: it takes a single input and flips it, 0 becomes 1 and 1 becomes 0. XOR (exclusive OR) outputs 1 only when the two inputs disagree — one is 0 and the other is 1 — and 0 when they agree. NAND, NOR, and XNOR are simply AND, OR, and XOR with the output inverted — NAND outputs 0 only when AND would output 1, and so on.

Worked Example

With the calculator's own defaults — the AND gate, both inputs at 0 — the output is 0, since AND requires both inputs to be 1. Toggle both Input A and Input B to 1 and the output flips to 1, matching AND's rule exactly. Switching to XOR with the same two inputs at 1 and 1 gives 0, since XOR requires the inputs to disagree, not just be true — this is the distinction that trips people up most often between OR and XOR.

Why NAND and NOR Are Called "Universal Gates"

NAND and NOR each have a special property: either one, wired in different combinations with itself, is enough to build every other gate on this page — AND, OR, NOT, XOR, and more — with no other gate type needed at all. This is a major reason NAND gates in particular are so common in real integrated circuits: a chip manufacturer can standardize on producing just one gate type and still build arbitrarily complex logic from it.

A Brief History of Boolean Logic

The mathematical foundation behind logic gates comes from George Boole's 1854 book "An Investigation of the Laws of Thought," which formalized logical reasoning (AND, OR, NOT) as an algebra operating on just two values — true and false. It took nearly a century before this pure mathematics found its electronic application: Claude Shannon's 1937 master's thesis showed that Boolean algebra could describe the behavior of switching circuits built from relays, directly connecting Boole's abstract logic to physical electronic hardware and laying the theoretical groundwork for every digital computer built since.

Common Logic Gate Mistakes

Confusing OR and XOR is the single most common error — OR is satisfied by either input being true (including both), while XOR specifically excludes the case where both inputs agree. Assuming NAND is simply "not AND" applied loosely, rather than the precise inverted-AND truth table, can lead to sign errors when combining gates by hand. Forgetting that NOT only takes one input — trying to feed it two — is a frequent beginner mistake this calculator sidesteps by hiding Input B automatically in NOT mode.

Logic Gate Terms You Should Know

Truth Table — a table listing every possible combination of a gate's inputs alongside the resulting output, fully defining the gate's behavior.

Boolean Algebra — the branch of algebra where variables take only two values (true/false, or 1/0), the mathematical foundation for all digital logic.

Universal Gate — a gate type (NAND or NOR) that can be combined with itself to construct every other logic gate, with no other gate type needed.

Combinational Logic — a circuit built purely from logic gates, where the output depends only on the current inputs, with no memory of past inputs.

Frequently Asked Questions

What is a logic gate?

A logic gate is a basic digital circuit building block that takes one or more binary (0/1) inputs and produces a single binary output, according to a fixed rule. Combinations of just a handful of gate types — AND, OR, NOT, and a few derived from them — are enough to build any digital circuit, including a full computer processor.

What's the difference between NAND and NOR?

NAND is the inverted output of AND — it outputs 0 only when both inputs are 1, and 1 otherwise. NOR is the inverted output of OR — it outputs 1 only when both inputs are 0, and 0 otherwise. Both are called "universal gates" because either one, alone, is enough to build every other logic gate.

Why does XOR only output 1 for exactly one input being 1?

XOR (exclusive OR) is designed to detect a difference between its two inputs, not just check that at least one is 1. It outputs 1 only when the inputs disagree (one is 0 and the other is 1) and outputs 0 when they agree (both 0 or both 1) — this is what makes it useful for binary addition and error-detection circuits.

Ad Space