# Truth Table Generator

URL: https://speedycalculator.com/calculators/math/truth-table/
Last updated: 2026-11-08

> The truth table generator builds the full truth table of a logical expression with up to six variables, evaluates a single row, or shows the table of a standard logic gate.

## Inputs

- I want to generate…
- Logical expression
- Truth values in alphabetical order of the variables (e.g. T F T)
- Logic gate

## Results

- Truth table
- Summary
- Variables

## Formula

```
Rows = 2ⁿ for n variables
Operators: not, and, or, xor, nand, nor, xnor, → (implies), ↔ (if and only if)
```

## Explanation

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.

## 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.

## FAQ

**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 &, |, ~, ^.


## Sources

- [OpenStax: Contemporary Mathematics](https://openstax.org/details/books/contemporary-mathematics)
- [Wolfram MathWorld: Truth table](https://mathworld.wolfram.com/TruthTable.html)
