Math Calculators
Truth Table Generator
Generate truth tables for any Boolean expression using variables A–Z and operators AND, OR, NOT, XOR, NAND, NOR, XNOR with parentheses.
Operators: AND, OR, NOT, XOR, NAND, NOR, XNOR. Variables: A–Z.
| A | B | Result |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Boolean operator reference
| Operator | Symbol(s) | Meaning | True when… |
|---|---|---|---|
| AND | ∧ or && | Conjunction | Both operands are true |
| OR | ∨ or || | Disjunction | At least one operand is true |
| NOT | ¬ or ! | Negation | The operand is false |
| XOR | ⊕ or ^ | Exclusive or | Exactly one operand is true |
| NAND | ↑ (Sheffer stroke) | Not AND | At least one operand is false |
| NOR | ↓ (Peirce arrow) | Not OR | Both operands are false |
| Implication | -> or ⋒ | If…then | Antecedent is false, or consequent is true |
| Biconditional | ↔ or ⇔ | If and only if | Both operands have the same truth value |
Operator precedence (highest to lowest)
- ¬ (NOT)
- ∧ (AND)
- ∨ (OR)
- ⊕ (XOR)
- -> (Implication)
- ↔ (Biconditional)
Use parentheses to override precedence and make complex expressions unambiguous.
How to read a truth table
A truth table lists every possible combination of true (T) and false (F) values for the input variables, then shows the output for each combination. With n variables, there are 2ⁿ rows.
Example: evaluate (A AND B) OR NOT C for A=T, B=F, C=T:
- Evaluate innermost / highest-precedence first: NOT C = NOT T = F
- Evaluate AND: A AND B = T AND F = F
- Evaluate OR: F OR F = F
The full table would have 2³ = 8 rows, one for each combination of A, B, and C. Read each row independently, following the same step-by-step precedence order.
Logic gates and digital circuits
Boolean logic is the foundation of digital electronics. Each operator corresponds to a logic gate that can be implemented in hardware:
| Gate | Symbol | Boolean operator | Role in circuits |
|---|---|---|---|
| AND gate | ∧ | A AND B | Output high only when all inputs high |
| OR gate | ∨ | A OR B | Output high when any input high |
| NOT gate (inverter) | ¬ | NOT A | Flips the signal |
| NAND gate | ↑ | NOT (A AND B) | Universal gate - any circuit can be built from NAND alone |
| NOR gate | ↓ | NOT (A OR B) | Also universal |
| XOR gate | ⊕ | A XOR B | Used in adders and error detection (parity) |
Tautologies and contradictions
Some logical expressions have a fixed truth value regardless of the inputs:
- Tautology: always true. Example:
A OR NOT A. No matter what A is, this is always T. Used to prove logical completeness. - Contradiction: always false. Example:
A AND NOT A. A cannot be both true and false simultaneously. - Contingency: everything else - sometimes true, sometimes false depending on input values. Most real-world logic expressions are contingencies.
If the generated truth table has all T in the output column, the expression is a tautology. All F means a contradiction.