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. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

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.

Complete truth table for all seven gates

ABANDORNOT ANANDNORXORXNOR
000011101
010111010
100101010
111100001

Where each gate appears in real circuits

AND and OR are the workhorses of combinational logic — address decoders, multiplexers, and select lines. Whenever a circuit needs “both conditions true” it usually routes through an AND gate.

NOT is the inverter that shows up everywhere: converting active-high signals to active-low, building complementary outputs on busses, and enabling de Morgan transformations.

NAND is the most physically common gate in CMOS silicon. Fabricating NAND is cheaper in terms of transistor count than AND, so many cells in a standard-cell library are NAND-based and then logically inverted where needed. A two-input NAND needs four transistors; a two-input AND needs six.

NOR plays the same universal role as NAND for NOR-based designs and appears frequently in set-reset (SR) latches — the foundational one-bit memory element is two cross-coupled NOR gates.

XOR implements the sum bit in binary adders and is the backbone of parity generators and CRC circuits. A chain of XOR gates can check whether a block of data was transmitted without a single-bit error.

XNOR is XOR with an inversion: it outputs 1 when both inputs are equal. Comparators for multi-bit equality typically AND a string of XNOR outputs — if every XNOR gate reports equal, all bits match.

de Morgan’s theorem in practice

A useful identity when simplifying circuits:

  • NAND(A, B) = NOT(A AND B) = NOT A OR NOT B
  • NOR(A, B) = NOT(A OR B) = NOT A AND NOT B

This means a NAND gate with inverted inputs behaves like an OR gate, and a NOR gate with inverted inputs behaves like an AND gate — handy when you have more of one gate type available.

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 above covers every (A, B) combination so you can cross-check a circuit by hand.
  • Toggle both inputs to 1 to quickly distinguish OR (output 1) from XOR (output 0) — the key practical difference between the two.