Truth tables list the value of a logical statement for every combination of true and false inputs. They are used to test logical equivalence, design digital circuits and check arguments in philosophy and computer science.
How to use the Truth Table Generator
- I want to generate…
- Logical expression
- Truth values in alphabetical order of the variables (e.g. T F T)
- Logic gate
Everything is calculated in your browser, so results appear instantly and nothing you type is sent to a server.
How it works
The expression is parsed with the usual precedence (not, then and/nand, then xor/xnor, then or/nor, then →, then ↔). Use letters for variables, brackets for grouping and words or symbols (∧ ∨ ¬ → ↔) for operators.
Formula
Rows = 2ⁿ for n variables
Operators: not, and, or, xor, nand, nor, xnor, → (implies), ↔ (if and only if)
Worked example
Inputs: I want to generate…: The entire truth table; Logical expression: p and (q or not r).
Results: Truth table = p │ q │ r │ Result
F │ F │ F │ F
F │ F │ T │ F
F │ T │ F │ F
F │ T │ T │ F
T │ F │ F │ T
T │ F │ T │ F
T │ T │ F │ T
T │ T │ T │ T; Summary = Contingency: true in 3 of 8 rows; Variables = p, q, r.
Key terms
- Tautology
- A statement true for every assignment.
- Contradiction
- A statement false for every assignment.
Frequently asked questions
How many rows does a truth table have?
2ⁿ for n variables: 8 rows for 3 variables.
What is a tautology?
A statement that is true in every row, such as p or not p.
How does implication work?
p → q is false only when p is true and q is false.
How do I type the operators?
Use and, or, not, xor, nand, nor, xnor, -> and <->, or the symbols &, |, ~, ^.