What Is a Truth Table?

A truth table is a structured chart that displays the output of a logical expression for every possible input combination. Each row represents one scenario, showing what happens when variables take on specific true or false values. The rightmost column reveals whether the entire expression evaluates to true or false under those conditions.

Truth tables serve several purposes:

  • Verification: Confirm that a logical design produces the expected output in all cases.
  • Identification: Spot whether an expression is a tautology (always true) or a contradiction (always false).
  • Simplification: Compare different expressions to see if they're logically equivalent.
  • Circuit design: Map the behavior of logic gates before building hardware.

Building and Interpreting Truth Tables

Constructing a truth table follows a straightforward method. First, identify all distinct variables in your expression—these become column headers. Add one final column for the expression's result. Then systematically fill each row with a unique combination of input values, computing the expression's truth value for that row.

For an expression with n variables, the table always contains 2n rows because each variable has two states (true or false). A two-variable expression like A AND B needs 2² = 4 rows. Three variables require 2³ = 8 rows. Seven variables demand 2⁷ = 128 rows—which is why most generators cap full-table output at 6 variables.

Reading the results tells you about your expression's behavior: if every row shows true, it's a tautology. If every row shows false, it's unsatisfiable. Mixed results show conditional truth—the expression is true only for certain input combinations.

Truth Table Row Count Formula

The number of rows in a complete truth table depends directly on how many independent logical variables appear in your expression. Use this formula to predict table size:

Total rows = 2n

where n = number of distinct variables

  • n — The count of distinct Boolean variables in the logical expression

Common Logic Gates and Their Truth Tables

Logic gates are the physical building blocks of digital circuits. Their truth tables show the fundamental operations:

NOT Gate (inverter):

  • Input T → Output F
  • Input F → Output T

AND Gate (true only when both inputs are true):

  • T AND T = T
  • T AND F = F
  • F AND T = F
  • F AND F = F

OR Gate (true when at least one input is true):

  • T OR T = T
  • T OR F = T
  • F OR T = T
  • F OR F = F

XOR Gate (true when inputs differ):

  • T XOR T = F
  • T XOR F = T
  • F XOR T = T
  • F XOR F = F

NAND Gate (opposite of AND):

  • T NAND T = F
  • T NAND F = T
  • F NAND T = T
  • F NAND F = T

NOR Gate (opposite of OR):

  • T NOR T = F
  • T NOR F = F
  • F NOR T = F
  • F NOR F = T

NAND and NOR are universal gates—you can build any other logic function using only copies of a single universal gate type.

Tips for Working with Truth Tables

Avoid common pitfalls when generating and interpreting truth tables.

  1. Order your input combinations systematically — List variable combinations in binary order (e.g., 00, 01, 10, 11 for two variables). This prevents accidentally skipping a row and ensures your table is complete and easy to verify.
  2. Watch for operator precedence — NOT binds most tightly, then AND, then OR. Use parentheses to clarify intent: <code>(A OR B) AND C</code> differs from <code>A OR (B AND C)</code>. When in doubt, add brackets.
  3. Use shorthand notation carefully — Different contexts use different symbols: <code>+</code> for OR, <code>·</code> or juxtaposition for AND, <code>'</code> or <code>!</code> for NOT. Stick to one convention per analysis to avoid confusion.
  4. Verify tautologies with a complete table — If you need to prove an expression is always true (or always false), generate the full table, not just one row. A single true case doesn't prove the expression is a tautology.

Frequently Asked Questions

How many rows does a truth table have for four variables?

A four-variable expression requires 2⁴ = 16 rows. Each row represents one unique combination of the four variables' true/false states. This grows exponentially: five variables need 32 rows, six variables need 64 rows. Beyond six variables, displaying the full table becomes unwieldy, so most calculators switch to computing individual rows on demand.

What's the difference between AND and NAND?

AND returns true only when both inputs are true; in all other cases (TF, FT, FF) it returns false. NAND (NOT-AND) does the opposite: it's false only when both inputs are true, and returns true for all other input pairs. NAND is a universal gate, meaning you can construct AND, OR, and NOT gates using only NAND gates, making it essential in digital logic circuit design.

Can I test an expression with more than 10 variables?

The calculator's single-row mode supports up to 10 variables. For expressions with more variables, break the logic into smaller chunks and analyze each separately. Alternatively, you can verify only the specific input combinations that matter for your application rather than generating a complete table, which would exceed 1,024 rows.

What does it mean if every row in a truth table is true?

An expression that evaluates to true for every possible input combination is called a <em>tautology</em>. Classic examples include <code>A OR (NOT A)</code> and <code>(A AND B) OR (NOT (A AND B))</code>. Tautologies are logically sound—they're statements that must be true regardless of the values involved, making them useful as validation rules in programming and formal logic.

How do I know if two logical expressions are equivalent?

Generate truth tables for both expressions. If every row produces identical results, the expressions are logically equivalent—they describe the same logical relationship, even if written differently. For example, <code>NOT(A AND B)</code> and <code>(NOT A) OR (NOT B)</code> are equivalent (De Morgan's Law). Equivalence verification is crucial when simplifying circuits or refactoring code logic.

What's the fastest way to manually compute a single row?

Work left to right through the expression, applying operator precedence: NOT first, then AND, then OR. Use parentheses to guide your computation. Write down intermediate results to avoid errors. For complex expressions with many operators, breaking them into sub-expressions and computing those first (bottom-up) reduces cognitive load and catches mistakes faster.

More math calculators (see all)