Logic Gate Truth Table Reference

Truth tables for AND, OR, NOT, NAND, NOR, XOR, XNOR

Interactive truth tables for all seven basic digital logic gates: AND, OR, NOT, NAND, NOR, XOR, and XNOR. Toggle the inputs and watch each gate output update, with the Boolean expression for every gate. Runs in your browser.

What is the difference between OR and XOR?

OR outputs 1 if at least one input is 1, including when both are 1. XOR (exclusive OR) outputs 1 only when the inputs differ, so it gives 0 when both inputs are 1. XOR is the basis of binary addition and parity checks.

Digital logic is built from a small set of gates that each implement a Boolean function of one or two inputs. This reference shows the truth tables for all seven basic gates and lets you toggle the inputs to see every output live.

How it works

Each gate maps input bits to an output bit:

  • ANDA · B, output 1 only when both inputs are 1.
  • ORA + B, output 1 when at least one input is 1.
  • NOT¬A, the inverter; output is the opposite of A.
  • NAND¬(A · B), AND followed by an inverter.
  • NOR¬(A + B), OR followed by an inverter.
  • XORA ⊕ B, output 1 only when the inputs differ.
  • XNOR¬(A ⊕ B), output 1 only when the inputs are equal.

NAND and NOR are universal: any circuit can be built from one of them alone.

Tips and notes

  • XOR is the sum bit of a half-adder; AND is its carry bit.
  • XNOR is a single-bit equality check, used in comparators.
  • The full 4-row truth table below covers every (A, B) combination so you can cross-check a circuit by hand.