Digital Electronics

Logic Gates Truth Tables: AND, OR, NOT, NAND, NOR, XOR

By CourseTron Team ·  5 min read 💬 𝕏 in f

A truth table lists the output for every allowed input combination. Two independent binary inputs produce four rows; three produce eight. Keep a fixed input order, then evaluate each gate or intermediate node consistently.

Reviewed 12 November 2026 · Binary examples checked with executable tests.

On this page

    What is the complete two-input gate table?

    All four binary inputs for six two-input gates
    ABANDORNANDNORXORXNOR
    00001101
    01011010
    10011010
    11110001

    Read one row across before moving down. At A=B=1, AND and OR both produce 1, NAND and NOR produce 0, XOR produces 0 and XNOR produces 1. This row is a useful check against confusing XOR with OR.

    Two-input gate: four input rows, one output per row A B GATE Y = f(A,B) Rows (A,B): 00, 01, 10, 11 → 2² = 4 rows CourseTron · coursetron.com
    A two-input gate maps every (A,B) pair to a single output Y — four rows in total.

    How does the NOT gate differ?

    NOT is unary: Y=NOT A. Its table has only two rows, 0→1 and 1→0. Adding a redundant second input column does not turn NOT into a two-input function.

    The one-input NOT function
    ANOT A
    01
    10

    A tied-input NAND also inverts: NAND(A,A)=NOT A. Both inputs receive the same signal, so only the 00 and 11 rows of the NAND table can occur in that circuit.

    Universal NAND: tie the inputs to make an inverter A NAND Y = NAND(A,A) = Ā A = 0 → Y = 1 A = 1 → Y = 0 Matches the NAND rows 00 → 1 and 11 → 0. CourseTron · coursetron.com
    Tying both NAND inputs together gives NAND(A,A) = Ā, an inverter.

    How do you build a table for several connected gates?

    For Y=(A OR B) AND NOT C, add an intermediate column for A OR B and another for NOT C. This prevents an inversion at the last stage from being applied to the whole circuit by mistake.

    Y = (A OR B) AND NOT C
    ABCA OR BNOT CY
    000010
    001000
    010111
    011100
    100111
    101100
    110111
    111100

    Check two useful properties: every row with C=1 has Y=0, and every row with C=0 has Y equal to A OR B. These properties provide a second way to check the enumerated answers.

    What do X and unknown values mean?

    In a device function table, X often means “this input does not affect the specified result.” In a four-state HDL simulation, X usually represents an unknown or conflicting value. Those meanings are different. Do not copy an X from a datasheet into a simulation and assume it behaves like an arbitrary, stable binary digit.

    The tables here intentionally enumerate only 0 and 1. Unconnected inputs, metastability and electrical contention need additional device and timing analysis. A don't-care used for Boolean simplification is an explicit design assumption about which cases matter.

    How can you check a truth table yourself?

    1. Write all 2n binary combinations in a consistent order.
    2. Evaluate every intermediate node, keeping inversion brackets explicit.
    3. Check special cases such as all-zero, all-one and an asserted enable or inhibit.
    4. Compare a second formulation, such as De Morgan's identity or arithmetic for an adder.

    The downloadable lab tests check all four two-input rows, the half-adder cases and all eight full-adder inputs. For an explanation of symbols and physical limits, use the companion logic-gate guide.

    Additional circuit views

    XOR steps through all four rows A B 0 1 0 1 XOR Y = A⊕B 0 1 A=0, B=0 → Y=0 A=0, B=1 → Y=1 A=1, B=0 → Y=1 A=1, B=1 → Y=0 Output is 1 only when A and B differ. CourseTron · coursetron.com
    Animated XOR: the output is high only when A and B differ — watch it cycle through all four rows.

    Common questions

    Why are there four rows for two inputs?

    Each input can independently be 0 or 1, giving 2 × 2 = 4 combinations: 00, 01, 10 and 11.

    Why is XOR different from OR at 11?

    OR asks whether at least one input is 1. Two-input XOR asks whether the inputs differ. Both inputs being 1 satisfies OR but not XOR.

    Does a truth table include propagation delay?

    No. It describes the functional input-output relationship. Timing diagrams and electrical specifications describe when outputs become valid.

    References and checks

    Download the functional tests and model source. These check stated binary functions; they do not establish analog timing, physical implementation, fault coverage or board behavior.