How to make a truth table: step by step, with examples for 2, 3 and 4 variables
To make a truth table, list every combination of true and false for the variables (2ⁿ rows for n variables), add one column for each part of the expression from the inside out, and fill each column row by row with the rules of its connective. The last column is the value of the whole expression.
This guide goes through the steps with worked examples for 2, 3 and 4 variables, explains the row order, shows how to read the finished table (tautology, contradiction, equivalence, validity), and ends with making a truth table in a spreadsheet and in LaTeX. The tables are computed by the Tangibool engine, and each example links to a free generator that builds the same table.
What a truth table is
A truth table lists every possible combination of truth values for the variables of a logical expression, with the expression's value on each one. Because each variable is either true (T, or 1) or false (F, or 0), a table with n variables has 2ⁿ rows:
| Variables | Rows |
|---|---|
| 1 | 2 |
| 2 | 4 |
| 3 | 8 |
| 4 | 16 |
| 5 | 32 |
| 6 | 64 |
| 10 | 1,024 |
The table settles any question about the expression: it is complete, so nothing is left to argue about once it is filled in. The cost is size: every extra variable doubles the rows.
The rules for each connective
Every column of a truth table is filled with one of these rules:
| Connective | Written | True when | False when |
|---|---|---|---|
| NOT | ¬p | p is false | p is true |
| AND | p ∧ q | both are true | at least one is false |
| OR | p ∨ q | at least one is true | both are false |
| XOR (exclusive or) | p ⊕ q | exactly one is true | both are the same |
| If–then | p → q | p is false, or q is true | p is true and q is false |
| If and only if | p ↔ q | both are the same | they differ |
The operators page has each one's table, and the implication page explains the row that surprises people, a false p making p → q true.
How to make a truth table, step by step
Step 1. List the variables and count the rows. Find the distinct variables, n of them, and the table has 2ⁿ rows.
Step 2. Fill in the variable columns in order. Count in binary from 0 to 2ⁿ − 1, with F for 0 and T for 1. With three variables the first column is F F F F T T T T, the second F F T T F F T T and the third F T F T F T F T: the last column alternates every row, the one before it every two rows, and so on. This is the order Tangibool's tools use: row 0 has every variable false, and the first variable is the most significant bit, so the row number read in binary gives the values. Many textbooks list the rows the other way up, starting with all true; the rows are the same, only their order differs.
Step 3. Break the expression into parts. Work from the inside out, following the order of operations: brackets first, then NOT, then AND, then OR, then → and ↔. Give each part its own column. NOT p AND q means (¬p) ∧ q, not ¬(p ∧ q): the equivalence checker confirms the first reading, and the second reading differs, already on the row where p and q are both false.
Step 4. Fill each column row by row. Use the connective's rule and the columns it depends on, never the original variables directly when a part column already holds the value.
Step 5. Read the last column. It is the value of the whole expression on each row.
Example with 2 variables
Make the table of (p ∨ q) ∧ ¬(p ∧ q), “p or q, but not both”. Two variables give four rows. The parts, from the inside out, are p ∨ q, p ∧ q, ¬(p ∧ q), and the whole:
| # | p | q | p ∨ q | p ∧ q | ¬(p ∧ q) | (p ∨ q) ∧ ¬(p ∧ q) |
|---|---|---|---|---|---|---|
| 0 | FALSE | FALSE | FALSE | FALSE | TRUE | FALSE |
| 1 | FALSE | TRUE | TRUE | FALSE | TRUE | TRUE |
| 2 | TRUE | FALSE | TRUE | FALSE | TRUE | TRUE |
| 3 | TRUE | TRUE | TRUE | TRUE | FALSE | FALSE |
Computed by the Tangibool engine
The result is true on rows 1 and 2, where exactly one of p and q is true. That is the exclusive or, and the equivalence checker confirms the expression equals p ⊕ q. The truth table generator builds the same table from the expression.
Example with 3 variables
Make the table of (A ∧ B) ∨ ¬C. Three variables give eight rows:
| # | A | B | C | A ∧ B | ¬C | (A ∧ B) ∨ ¬C |
|---|---|---|---|---|---|---|
| 0 | FALSE | FALSE | FALSE | FALSE | TRUE | TRUE |
| 1 | FALSE | FALSE | TRUE | FALSE | FALSE | FALSE |
| 2 | FALSE | TRUE | FALSE | FALSE | TRUE | TRUE |
| 3 | FALSE | TRUE | TRUE | FALSE | FALSE | FALSE |
| 4 | TRUE | FALSE | FALSE | FALSE | TRUE | TRUE |
| 5 | TRUE | FALSE | TRUE | FALSE | FALSE | FALSE |
| 6 | TRUE | TRUE | FALSE | TRUE | TRUE | TRUE |
| 7 | TRUE | TRUE | TRUE | TRUE | FALSE | TRUE |
Computed by the Tangibool engine
The ¬C column is true on the even rows, where C is false, and A ∧ B on rows 6 and 7. Their OR is true on rows 0, 2, 4, 6 and 7. Generated.
Example with 4 variables
Make the table of (A ∧ B) ∨ (C ∧ D). Four variables give sixteen rows:
| # | A | B | C | D | A ∧ B | C ∧ D | (A ∧ B) ∨ (C ∧ D) |
|---|---|---|---|---|---|---|---|
| 0 | FALSE | FALSE | FALSE | FALSE | FALSE | FALSE | FALSE |
| 1 | FALSE | FALSE | FALSE | TRUE | FALSE | FALSE | FALSE |
| 2 | FALSE | FALSE | TRUE | FALSE | FALSE | FALSE | FALSE |
| 3 | FALSE | FALSE | TRUE | TRUE | FALSE | TRUE | TRUE |
| 4 | FALSE | TRUE | FALSE | FALSE | FALSE | FALSE | FALSE |
| 5 | FALSE | TRUE | FALSE | TRUE | FALSE | FALSE | FALSE |
| 6 | FALSE | TRUE | TRUE | FALSE | FALSE | FALSE | FALSE |
| 7 | FALSE | TRUE | TRUE | TRUE | FALSE | TRUE | TRUE |
| 8 | TRUE | FALSE | FALSE | FALSE | FALSE | FALSE | FALSE |
| 9 | TRUE | FALSE | FALSE | TRUE | FALSE | FALSE | FALSE |
| 10 | TRUE | FALSE | TRUE | FALSE | FALSE | FALSE | FALSE |
| 11 | TRUE | FALSE | TRUE | TRUE | FALSE | TRUE | TRUE |
| 12 | TRUE | TRUE | FALSE | FALSE | TRUE | FALSE | TRUE |
| 13 | TRUE | TRUE | FALSE | TRUE | TRUE | FALSE | TRUE |
| 14 | TRUE | TRUE | TRUE | FALSE | TRUE | FALSE | TRUE |
| 15 | TRUE | TRUE | TRUE | TRUE | TRUE | TRUE | TRUE |
Computed by the Tangibool engine
A ∧ B is true on rows 12 to 15, where A and B are both true, and C ∧ D on rows 3, 7, 11 and 15. Their OR is true on seven rows, 3, 7, 11, 12, 13, 14 and 15; row 15 is in both. Generated.
With four variables the pattern of the input columns is easy to check: the first column is eight F then eight T, the second four and four, the third two and two, and the fourth alternates.
Example with implications
Arrows are where most hand-made tables go wrong, so here is one with three: ((p → q) ∧ (q → r)) → (p → r), “if p leads to q and q leads to r, then p leads to r”. The parts are p → q, q → r, their AND, p → r, and the whole:
| # | p | q | r | p → q | q → r | (p → q) ∧ (q → r) | p → r | whole |
|---|---|---|---|---|---|---|---|---|
| 0 | FALSE | FALSE | FALSE | TRUE | TRUE | TRUE | TRUE | TRUE |
| 1 | FALSE | FALSE | TRUE | TRUE | TRUE | TRUE | TRUE | TRUE |
| 2 | FALSE | TRUE | FALSE | TRUE | FALSE | FALSE | TRUE | TRUE |
| 3 | FALSE | TRUE | TRUE | TRUE | TRUE | TRUE | TRUE | TRUE |
| 4 | TRUE | FALSE | FALSE | FALSE | TRUE | FALSE | FALSE | TRUE |
| 5 | TRUE | FALSE | TRUE | FALSE | TRUE | FALSE | TRUE | TRUE |
| 6 | TRUE | TRUE | FALSE | TRUE | FALSE | FALSE | FALSE | TRUE |
| 7 | TRUE | TRUE | TRUE | TRUE | TRUE | TRUE | TRUE | TRUE |
Computed by the Tangibool engine
Each arrow column is false only where its left side is true and its right side false. The AND column is true on rows 0, 1, 3 and 7. On each of those rows p → r is true as well, so the final arrow never has a true left side with a false right side, and the last column is true everywhere: the expression is a tautology, the rule called hypothetical syllogism. The truth table generator agrees.
Shortcuts
A full table is always safe, but some questions can stop early:
- To show an expression is not a tautology, one row where it is false is enough. For an implication, try to make its left side true and its right side false; if that is impossible, it is a tautology.
- In an AND column, a row is false as soon as one part is false, so fill the part that is false most often first. In an OR column, a row is true as soon as one part is true.
- For equivalence, stop at the first row where the two columns differ: that row is the counterexample.
Reading a finished truth table
The last column answers several questions at once:
- Tautology: true on every row. p → (q → p) is one. A tautology is a law of logic; it holds whatever the variables mean.
- Contradiction: false on every row. (p → q) ∧ p ∧ ¬q is one: it asks for an implication, its hypothesis and the failure of its conclusion all at once.
- Contingency: true on some rows and false on others, like p → q. Most expressions are contingent.
- Satisfiable: true on at least one row, so either contingent or a tautology.
Two columns in one table answer questions about two expressions:
- Equivalence. Two expressions are logically equivalent when their columns are the same on every row. ¬(p ∨ q) and ¬p ∧ ¬q are, which is De Morgan's law; ¬(p ∨ q) and ¬p ∨ ¬q are not, and the first row where the columns differ is the counterexample.
- Validity. An argument is valid when every row that makes all its premises true also makes its conclusion true. From p ∨ q and ¬p, q follows: on the one row where both premises are true, q is true.
The tautology, contradiction, contingency and logical equivalence entries in the glossary define each term.
Making a truth table in a spreadsheet
A spreadsheet can generate the rows for you:
- In column A, number the rows from 0 to 2ⁿ − 1, starting in A2.
- Fill the variable columns from the row number. For three variables, put
=ISODD(INT($A2/4))in B2,=ISODD(INT($A2/2))in C2 and=ISODD($A2)in D2, and fill them down. The first variable is the 4s bit, the second the 2s bit, and the third the 1s bit, which gives the same order as the tables above. - Write the expression with the spreadsheet's logical functions. For (A ∧ B) ∨ ¬C, put
=OR(AND(B2, C2), NOT(D2))in E2 and fill it down.
Excel and Google Sheets both use AND, OR and NOT as functions with the arguments in brackets, and XOR in the same way. There is no implication function; write p → q as =OR(NOT(p), q). The Excel page lists the functions, including their Spanish names.
Making a truth table in LaTeX
A truth table in LaTeX is a tabular with one column per variable or part, and a vertical rule before the result: \begin{tabular}{cc|c}, then a header row such as $p$ & $q$ & $p \land q$ \\ \hline, then one row per line, such as F & F & F \\, and \end{tabular} at the end. The symbols are \lnot, \land, \lor, \oplus, \to and \leftrightarrow. The truth table generator downloads any table it builds as a LaTeX tabular, as CSV or as Markdown, and the LaTeX page has the notation.
Common mistakes
- Missing rows. n variables need all 2ⁿ rows. Counting in binary is the safe way to list them.
- Applying NOT to too much or too little. ¬p ∧ q negates only p.
- Filling the → column wrongly. p → q is false only when p is true and q is false; it is true on both rows where p is false.
- Reading OR as exclusive. p ∨ q is true when both are true.
- Mixing row orders. When comparing your table with a book's, check whether its first row is all true or all false.
Make one yourself
- Type an expression into the truth table generator, for example
(A AND B) OR NOT C. It accepts AND, OR, NOT, XOR,->and<->, or the symbols ∧, ∨, ¬, ⊕, → and ↔. - It lists every row in the order used here, up to 12 variables, says whether the expression is a tautology, a contradiction or contingent, and reads it back in plain English.
- To compare two expressions, use the equivalence checker; to test an argument, the argument validity checker.
Frequently asked questions
What is a truth table?
A table that lists every combination of true and false for the variables of an expression, with the expression's value on each row.
How many rows does a truth table have?
2ⁿ for n variables: 4 for two variables, 8 for three, 16 for four.
How do you make a truth table with 3 variables?
Make eight rows; fill the first variable with four F then four T, the second with two F, two T, two F, two T, and the third alternating; then add a column for each part of the expression and fill them row by row.
How do you make a truth table with 4 variables?
The same way with sixteen rows: the first column is eight F then eight T, the second alternates in fours, the third in twos and the fourth every row.
What order should the rows of a truth table be in?
Any order works if every combination appears once. Counting in binary from all false to all true, as here, or from all true to all false, as in many logic books, makes the table easy to check.
How do you read a truth table?
Look at the last column. True on every row means a tautology, false on every row a contradiction, and a mix a contingency. Two expressions with identical columns are equivalent.
What are the rules of truth tables?
Each connective has a rule: NOT flips the value, AND needs both true, OR needs at least one true, → is false only when the first part is true and the second false, and ↔ needs both the same.
Can I make a truth table in Excel?
Yes: number the rows, fill the variable columns with ISODD and INT from the row number, and write the expression with AND, OR and NOT.
Related pages
- Guides: Boolean logic
- Lesson 4: truth tables and the truth table glossary entry
- Practice with answers: 2 variables, 3 variables and 4 variables
- Operator precedence and the operators
- Tautology, contradiction or contingency: exercises
- The truth table generator
Written by Muaz Notiar. The Tangibool engine (semantics tangibool-semantics/1, engine 1.0.0) computed the 4 truth tables marked “Computed by the Tangibool engine”, and the 13 tool results the guide links to were re-run through the tools' own code in the build of and match what the text says. © 2026 Foreranger LTD.