Welcome to Omni’s truth table generator! Whether you are a beginning programmer or an advanced logician, here you will find everything you need to handle complex logical expressions and solve their related truth tables. Read on to learn:
- What a truth table is;
- How to use our truth table calculator to solve truth tables;
- How to generate the truth tables of logic gates, including the XOR gate truth table and the NAND truth table.
In dedicated articles, we cover the mathematical background of Boolean algebra and logic and the link with set theory.
What is a truth table?
A truth table is a small chart that shows how the truth value of a compound logical expression depends on the truth or falsity of its parts. For every possible combination of truth values of the basic statements, the table tells us whether the whole expression is true or false. In particular, the truth table can show if the expression under consideration is true for all legitimate input values, in which case we call it a tautology.
How do you solve a truth table?
To solve a truth table:
- List all input variables involved in the logical expression under consideration.
- Create a column for each variable.
- Add a final column for the result.
- Fill the table row by row with every possible combination of truth values for the inputs.
- For each combination, compute whether the expression is true or false.
For example, in the expression A XOR B, there are two variables (A and B), so we have three columns in total. The four possible combinations are as follows:
Afalse,Bfalse;Atrue,Bfalse;Afalse,Btrue; andAtrue,Btrue.
A detailed explanation of how to make a truth table, together with practical examples, can be found on the dedicated page How to Make a Truth Table?
🙋 Remember, you can use Omni’s truth table calculator to quickly generate a truth table of complicated logical expressions!
How many rows are there in a truth table?
The size of a truth table depends on the number of logical variables involved. We can have as few as 2 rows (for the NOT gate) or 4 rows (for other basic gates), but also as many as 128 = 27 rows for an expression with 7 variables.
In general, for n variables, the complete table has 2n rows, because every variable can take two values: true or false, and the truth table has to include all the possible combinations.
🔎 See Omni Calculator’s possible combinations calculator to understand how we get this result.
How to use Omni’s truth table generator
To most efficiently use our truth table calculator, follow these steps:
-
Pick the calculator’s mode. You can:
- Generate an entire truth table. Since our truth table solver outputs a maximum of 64 rows, full truth tables can be generated for expressions with up to 6 variables.
- Generate a single row of a truth table: Here, you can determine the logical value of a logical expression containing up to 10 variables.
For longer expressions, divide them into chunks and analyse each chunk. - Generate truth tables of logic gates. Use this mode if you need to quickly obtain, for example, the XOR gate’s truth table. In this mode, you only need to choose the logic gate you are interested in.
-
In the first mode, you need to input a correct logical expression.
- Start simple and build it up.
- Remember, you can copy-paste the logical connectors from the bottom box of Omni’s truth table generator.
-
In the second mode:
- Before you input a logical expression, you first need to input the number of variables in your expression.
- Then Omni’s truth table solver generates the desired number of input fields, where you can declare the truth value of each variable. You do this by inputting the letters T or F for true or false.
- Our truth table generator will then compute the final logical value of your expression.
Truth tables of logic gates
Here we discuss the truth tables of the most common logic gates, which are the building blocks of circuits, so in particular of the device you're now reading these words on. To learn more about the technical side of logic gates, visit our dedicated article What is a Logic Gate?
NOT gate truth table
A | NOT A |
|---|---|
T | F |
F | T |
The NOT gate flips the input: true becomes false, false becomes true.
AND gate truth table
A | B | A AND B |
|---|---|---|
T | T | T |
T | F | F |
F | T | F |
F | F | F |
The AND gate returns true only if both inputs are true.
OR gate truth table
A | B | A OR B |
|---|---|---|
T | T | T |
T | F | T |
F | T | T |
F | F | F |
The OR gate returns true only if at least one input is true.
NAND gate truth table (NOT AND)
A | B | A NAND B |
|---|---|---|
T | T | F |
T | F | T |
F | T | T |
F | F | T |
NAND returns true unless both inputs are true.
XOR gate truth table (exclusive OR)
A | B | A XOR B |
|---|---|---|
T | T | F |
T | F | T |
F | T | T |
F | F | F |
XOR is true only if exactly one input is true. In other words, if the inputs have two different values.
NOR gate truth table (NOT OR)
A | B | A NOR B |
|---|---|---|
T | T | F |
T | F | F |
F | T | F |
F | F | T |
NOR is true only if neither input is true.
XNOR gate truth table (exclusive NOR)
A | B | A XNOR B |
|---|---|---|
T | T | T |
T | F | F |
F | T | F |
F | F | T |
XNOR is true if the inputs are the same (both true or both false).
💡 To quickly generate the truth tables of all logic gates, use Mode 3 of Omni’s truth table generator.
FAQs
What is tautology in logic?
In logic, a tautology is a logical statement that is always true, no matter the truth values of its components. If you checked it with a truth table, every possible case (each row) would give the result “true.”
What are universal gates?
Universal gates are special logic gates that can be used to create any other logic gate: AND, OR, NOT, XOR, XNOR, and thus to build every other logical operation. The two universal gates are NAND and NOR: with enough of them, you could, in theory, build a whole computer!
Is true or false true?
Yes, the logical expression true or false is true. This result holds because the logical connector or evaluates to true if and only if at least one of its inputs is true. Since in our case the first input has the value true, the whole statement is true.