Truth Table Generator
Generate the full truth table for any boolean expression.
| A | B | Result |
|---|---|---|
| T | T | T |
| T | F | F |
| F | T | F |
| F | F | F |
2 variables → 4 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).
| A | B | A ∧ B (AND) | A ∨ B (OR) | A ⊕ B (XOR) | ¬A (NOT) |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 1 | 0 | 0 |
| 1 | 0 | 0 | 1 | 1 | 0 |
| 0 | 1 | 0 | 1 | 1 | 1 |
| 0 | 0 | 0 | 0 | 0 | 1 |
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 Find the variables. A AND B uses two distinct variables, A and B.
- 2 Count the rows. With n variables there are 2ⁿ rows. Here n = 2, so 2² = 4 rows.
- 3 List every input combination. Enumerate all four: A,B = TT, TF, FT, FF. Each row is a unique pair.
- 4 Evaluate the expression per row. AND is true only when both inputs are true: TT→T, TF→F, FT→F, FF→F.
- 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.