Truth Table Generator

Enter a Boolean expression and generate every input combination, intermediate result, and final truth value.

Boolean ExpressionsLogic GatesUp to 8 VariablesIntermediate Steps
Share this tool
/500

Use variable names, parentheses, and the buttons below. Text aliases such as AND, OR, NOT, XOR, NAND, NOR, IMPLIES, and IFF also work.

Insert operator

Table size

detected variables · up to 256 rows

Quick Load

Generating truth table...

T/F

Enter a Boolean expression or choose a quick-load example, then generate its complete truth table.

How to Use the Truth Table Generator

The truth table generator converts a Boolean expression into every possible assignment of true and false values. Enter variables such as A, B, P, or DoorOpen, connect them with Boolean operators, and select Generate Truth Table. The result lists the variables in their first-seen order and places the complete expression in the final column.

You can type common words such as AND, OR, NOT, XOR, NAND, NOR, IMPLIES, and IFF. Symbolic forms including ¬, ∧, ∨, ⊕, →, and ↔ are also supported. Parentheses make grouping explicit. Enable intermediate columns when you want to inspect how each subexpression contributes to the final result, which is especially useful when checking homework or tracing a digital-logic design.

The display selector changes truth values between T/F, 1/0, and True/False without changing the underlying logic. Expressions are evaluated on the server with a defined operator precedence, and the tool accepts up to eight distinct variables. That limit produces at most 256 rows, keeping the complete table readable and responsive on phones as well as desktop screens.

How Boolean Expression Truth Tables Work

A Boolean variable has exactly two possible values: true or false. A truth table systematically assigns those values to every variable, then evaluates the expression once per assignment. With one variable there are two combinations. With two variables there are four, and with three variables there are eight. In general, an expression containing n distinct variables requires 2n rows.

The rows are not guesses or samples; they exhaust the possible inputs within classical two-valued logic. That completeness makes truth tables useful for proving equivalence, finding counterexamples, checking conditions in software, and understanding combinational logic circuits. The final column describes the Boolean function computed by the entire expression.

How a Truth Table Is BuiltA Boolean expression is parsed, all input combinations are generated, and each row is evaluated to produce an output column.1 · EXPRESSION(A ∨ B) ∧ ¬CParse operators and grouping2 · COMBINATIONST T T · T T FT F T · T F FAll 2³ = 8 assignments3 · OUTPUTF · T · F · T …Evaluate the final column

Boolean Operators and Logic Gate Symbols

Each operator defines a small truth function. NOT reverses one input. AND requires both inputs to be true, while inclusive OR requires at least one. XOR is different from inclusive OR because XOR is false when both inputs are true. NAND and NOR negate AND and OR respectively, and each can be used as a universal gate in digital circuit construction.

OperationAccepted inputSymbolResult ruleLogic name
NOTNOT A, !A, ~A¬True when A is falseInverter
ANDA AND B, A & B∧True only when both are trueAND gate
NANDA NAND BNANDFalse only when both are trueNAND gate
ORA OR B, A | B∨True when either or both are trueOR gate
NORA NOR BNORTrue only when both are falseNOR gate
XORA XOR B, A ^ B⊕True when inputs differXOR gate
ImplicationA -> B, A IMPLIES B→False only when A is true and B is falseMaterial implication
EquivalenceA IFF B, A XNOR B↔True when inputs matchXNOR gate

Operator Precedence in Boolean Expressions

When parentheses do not settle the order, this calculator evaluates NOT first, followed by AND or NAND, XOR, OR or NOR, implication, and finally equivalence. Most binary operators associate from left to right. Implication associates from right to left, so A → B → C means A → (B → C).

Precedence conventions can differ between textbooks and programming languages. Parentheses are therefore the safest way to communicate intent. Writing (A OR B) AND C is clearer than relying on a reader to remember which connective binds more tightly.

Tautologies, Contradictions, and Contingencies

A tautology is true on every row. For example, A OR NOT A is always true in classical logic. A contradiction, such as A AND NOT A, is false on every row. A contingency has a mixture of true and false results, so its value depends on the inputs.

The classification badge summarizes the final column, while the distribution bar shows the exact number of true and false rows. This provides a quick check without replacing the complete table.

Truth Table Generator FAQ

How do I make a truth table from a Boolean expression?

List every variable, create all 2n true/false assignments, and evaluate the operations in each row. This generator performs those steps and can expose intermediate subexpressions so you can verify the calculation.

What is the order of operations in Boolean logic?

This tool uses NOT, AND/NAND, XOR, OR/NOR, implication, then equivalence from strongest to weakest. Parentheses override that order and are recommended whenever an expression could be read in more than one way.

What is the difference between OR and XOR?

Inclusive OR is true when either input or both inputs are true. XOR means exclusive OR, so it is true only when exactly one of its two inputs is true.

How many rows does a truth table need?

A complete table with n variables contains 2n rows because every variable independently has two values. Three variables need eight rows, while eight variables need 256 rows.

What makes a Boolean expression a tautology?

An expression is a tautology when its final column is true under every possible variable assignment. Truth-table equivalence proofs often form a biconditional between two expressions and check whether that biconditional is a tautology.

Can I use implication and biconditional operators?

Yes. Enter implication with →, ->, =>, or IMPLIES, and enter biconditional with ↔, <->, <=>, IFF, or XNOR. Material implication is false only when the antecedent is true and the consequent is false.

Related Calculators