Skip to content
K Knidox Search…
Computer Science · Logic

Truth Table Generator

Generate the full truth table for any boolean expression.

Variables A–Z. Operators: NOT ! ¬, AND & ∧, OR | ∨, XOR ^ ⊕, and parentheses.
ABResult
TTT
TFF
FTF
FFF

2 variables4 rows (22).

A truth table lists every possible combination of a boolean expression’s inputs alongside the resulting output. For two variables there are four rows. The expression A AND B is true only when both A and B are true — its output column reads T, F, F, F as you step through TT, TF, FT, FF.

What a truth table is

A truth table is a complete map of a boolean function. Each input variable gets a column, every row is one combination of true/false values for those inputs, and a final column holds the output the expression produces for that row. Because every combination appears exactly once, the table fully defines the logic — there is nothing left to assume. This makes truth tables the standard way to specify, compare, and verify logic gates and boolean formulas.

The basic gates

Outputs for the four core operators (1 = true, 0 = false).

ABA ∧ B (AND)A ∨ B (OR)A ⊕ B (XOR)¬A (NOT)
111100
100110
010111
000001

Worked example: building the table for A AND B

The expression has two variables, so it has 2² = 4 rows. Fill the input columns by counting down from all-true, then evaluate AND in each row.

  1. 1
    Find the variables. A AND B uses two distinct variables, A and B.
  2. 2
    Count the rows. With n variables there are 2ⁿ rows. Here n = 2, so 2² = 4 rows.
  3. 3
    List every input combination. Enumerate all four: A,B = TT, TF, FT, FF. Each row is a unique pair.
  4. 4
    Evaluate the expression per row. AND is true only when both inputs are true: TT→T, TF→F, FT→F, FF→F.
  5. 5
    Read off the result column. The output is T, F, F, F — confirming A AND B is true in exactly one of four cases.

Rows, precedence, and verifying logic

The number of rows is always 2ⁿ for n variables, so the table doubles with each new input — three variables give eight rows, four give sixteen. Operators bind by precedence: NOT (¬) is strongest, then AND (∧), then XOR (⊕), then OR (∨), so A OR B AND C means A OR (B AND C). Use parentheses when you want a different grouping. Truth tables are how engineers verify that a simplified formula matches the original and that a circuit behaves as intended: if two expressions produce identical output columns for every row, they are logically equivalent.

What is a truth table?
A truth table lists every combination of input values for a boolean expression and the output each combination produces. It fully defines the logic, because every possible input appears exactly once.
Which operators and symbols are supported?
NOT (also ! ~ ¬), AND (also & && ∧ ·), OR (also | || ∨ +), XOR (also ^ ⊕), and parentheses. You can type the word or the symbol — “A AND B”, “A & B”, and “A ∧ B” all mean the same thing.
How many rows will my table have?
A table with n distinct variables has 2ⁿ rows — one per input combination. Two variables give 4 rows, three give 8, four give 16. This tool caps expressions at 8 variables (256 rows) to keep the table readable.
What is the operator precedence?
From strongest to weakest: NOT, then AND, then XOR, then OR. So A OR B AND C is read as A OR (B AND C). Add parentheses whenever you want a grouping that differs from the default.
What is the difference between AND, OR, and XOR?
AND (∧) is true only when both inputs are true. OR (∨) is true when at least one input is true. XOR (⊕) is true when the inputs differ — exactly one is true, but not both.
Do variable names have to be uppercase letters?
Use single letters such as A, B, C. The tool treats them case-insensitively and reads each distinct letter as one variable, then sorts the columns alphabetically.