Skip to content
ZeroServer.tools

Truth Table Generator

Generate a complete truth table for any logical expression using AND, OR, NOT, XOR.

Preset Expressions

Operators: AND, OR, NOT, XOR, NAND, NOR, XNOR — or symbols: &&, ||, !, ^

Variables3
Total Rows8
True Results5
False Results3
True Ratio63%
Generated Table
ABCResult
FFFT
FFTF
FTFT
FTTF
TFFT
TFTF
TTFT
TTTT

8 rows for 3 variables: A, B, C

About Truth Table Generator

Instantly generate complete truth tables for any Boolean (logical) expression. Enter your formula using variables like A, B, C and combine them with AND, OR, NOT, XOR, NAND, NOR, or XNOR — or shorthand symbols like &&, ||, and !. The generator automatically identifies all unique variables, enumerates every possible combination of true/false inputs (2^n rows), evaluates the expression for each row, and highlights the result in green for true or red for false. Toggle between T/F and 1/0 notation to match your textbook or tooling. Ideal for digital logic design, discrete mathematics coursework, and verifying Boolean identities such as De Morgan's laws.

Built and maintained by Meet Shah · Last updated

What this tool is used for

  • Checking whether a refactored boolean condition is equivalent to the original.
  • Enumerating every input combination for a guard clause before writing tests.
  • Finding the case where two expressions you believed identical actually differ.
  • Simplifying a condition by seeing which rows the extra term never changes.
  • Teaching operator precedence by showing what changes when parentheses move.

Frequently Asked Questions

How many rows does a table have?
2ⁿ for n variables — 4 for two, 8 for three, 1,024 for ten. That doubling is why exhaustive verification stops being practical quickly, and why satisfiability solvers exist rather than everyone enumerating.
What are the standard operator precedences?
NOT binds tightest, then AND, then OR — so `A OR B AND C` means `A OR (B AND C)`. XOR and the negated forms vary by convention, which is exactly why parenthesising anything non-trivial is worth doing.
What makes NAND and NOR special?
Each is functionally complete — every other operator can be built from NAND alone, or from NOR alone. That is why real hardware is built predominantly from NAND gates: one gate type suffices for the entire logic of a processor.
What is the difference between a tautology and a contradiction?
A tautology is true in every row and a contradiction false in every row. Both are worth spotting in a real expression, because they usually mean a condition that always fires or a branch that can never execute.
How do De Morgan's laws show up here?
NOT(A AND B) has the same column as (NOT A) OR (NOT B), and the same for the dual. Seeing two different expressions produce identical columns is the clearest demonstration that they are equivalent — which is what the table is for.

Common errors and gotchas

  • Assuming your language's precedence matches the notation, which is where a missing parenthesis hides.
  • Ignoring short-circuit evaluation, which a truth table cannot express but your code depends on.
  • Treating a table over booleans as covering nullable or truthy values, which have more than two states.
  • Adding a variable and not noticing the row count doubles, so a case gets skipped in review.
  • Reading XOR as inclusive or, which differs in exactly one row and is easy to miss.

Related Developer Utilities tools

Private & free — this tool runs entirely in your browser.

IndieKitShip your Next.js startup in days.affiliate