Truth Table Generator
Generate truth tables for logical expressions with AND, OR, NOT, XOR, NAND, and NOR operations.
Perfect for computer science and discrete math.
Boolean Logic Operations Boolean logic works with two values: True (1) and False (0). The fundamental operations combine these values in specific ways. Every digital circuit, programming condition, and logical argument uses these operations.
AND (conjunction): Returns True only when ALL inputs are True. Written as A AND B, A & B, or A * B. In a truth table: 0&0=0, 0&1=0, 1&0=0, 1&1=1. Think of it as “both must be true.”
OR (disjunction): Returns True when ANY input is True. Written as A OR B, A | B, or A + B. In a truth table: 0|0=0, 0|1=1, 1|0=1, 1|1=1. Think of it as “at least one must be true.”
NOT (negation): Flips the value. Written as NOT A or !A. NOT 0 = 1, NOT 1 = 0.
XOR (exclusive or): With two inputs, returns True when they DIFFER. Written as A XOR B or A ^ B. 0^0=0, 0^1=1, 1^0=1, 1^1=0. “Exactly one must be true” is the usual gloss, and it is right for two inputs only. With three, XOR is true when an odd number are true, so 1,1,1 gives 1.
XNOR: The opposite of XOR. With two inputs it is the equality test, returning True when both match. With more inputs it is True when an even number are True, counting zero as even.
NAND (not-and): The opposite of AND. Returns False only when all inputs are True. NAND is “universal”: any other gate can be built from NAND gates alone, which is why it dominates chip design.
NOR (not-or): The opposite of OR. Returns True only when all inputs are False. NOR is also universal, and the Apollo Guidance Computer was built entirely from NOR gates.
A trap with three or more inputs. AND, OR and XOR are associative, so “A AND B AND C” is unambiguous however you bracket it. NAND, NOR and XNOR are not. Chaining (A NAND B) NAND C is a different function from a three-input NAND gate: for A = B = C = 1 the chain gives 1 and the gate gives 0. This calculator generates the multi-input gate, and labels it NAND(A, B, C) rather than infix, precisely so the two do not get confused.
Truth Table Construction For N variables, a truth table has 2^N rows. Each row represents one possible combination of True/False values for all variables. The rows are typically listed in binary counting order (000, 001, 010, 011, …).
Practical Applications Circuit design uses truth tables to define the behavior of digital logic gates. Programming uses boolean logic in every if/else statement. Database queries use AND, OR, NOT in WHERE clauses. Mathematical proofs in discrete math rely on logical equivalence via truth tables.
How we build and check this calculator
This calculator runs entirely in your browser, so the numbers you enter stay on your device. The math behind it is written by hand and tested against worked examples and standard references before the page goes live.
SuperGlobalCalculator is independently built and maintained. See how we build and verify our calculators.