Tool to generate logical truth tables. In Boolean algebra or electronics, logical truth tables allow defining a function / gate / element / component according to its inputs and outputs.
Truth Table - dCode
Tag(s) : Symbolic Computation, Electronics
dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!
A truth table is a table representing the output boolean values of a logical expression based on their entries. The table thus displays all the possible combinations of the $ n $ input logical variables (generally 0 / FALSE and 1 / TRUE over $ n $ columns) and the result of the equation as output (last column).
Example: The table of the logical NOT function with 1 input A (1st column) and the output value NOT A (last column):
A | NOT A |
---|---|
0 | 1 |
1 | 0 |
Every electronic circuit is associated with a truth table which describes it.
Usually the array starts with input values at $ 0 $ and ends with input values at $ 1 $ but sometimes it's reversed.
dCode truth table generator interprets the Boolean logical expression and calculates (using Boolean algebra) all the possible combinations of 0 and 1 for each variable (among the Boolean variables requested) in order to make the truth table.
dCode also makes it possible to find the Boolean logic function/expression from a truth table.
The only important column of the truth table is the last one, which describes the output values (the first columns are always identical for a given number of inputs) and which allows to convert into the Boolean expression.
There are 2 methods to find the Boolean equation from the truth table, either by using the output values 0 (calculation of Maxterms) or by using output values 1 (calculation of Minterms).
Example: The output values are 0,1,1,0, (and the table is ordered from 00 to 11), so the truth table is:
input A | input B | output X |
---|---|---|
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 0 |
Here are the different calculations (which give the same result for the given example)
Calculation from the output values 1 of the truth table (Minterms): for each 1, write the corresponding input values separated by logical AND, then group these results with a logical OR.
Example: Rows 2 and 3 are equal to 1, row 2 is written as A AND NOT(B) (because A is 1 and B is 0), row 3 is written as NOT(A) AND B and therefore the equation is (A AND NOT(B)) OR (NOT(A) AND B) which possibly simplifies to A XOR B
Calculation from the output values 0 of the truth table (Maxterms): for each 0, write the corresponding input values separated by logical OR, then group these results with a logical AND.
Example: Rows 1 and 4 are equal to 0, row 1 is written as A OR B, row 4 is written as NOT(A) OR NOT(B) and therefore the equation is (A OR B) AND (NOT(A) OR NOT(B)) which possibly simplifies to A XOR B
The truth table for the AND function is:
A | B | A AND B |
---|---|---|
0 | 0 | 0 |
0 | 1 | 0 |
1 | 0 | 0 |
1 | 1 | 1 |
The truth table for the OR function is:
A | B | A OR B |
---|---|---|
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 1 |
The truth table for the NAND function is:
A | B | A NAND B |
---|---|---|
0 | 0 | 1 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 0 |
The truth table for the NOR function is:
A | B | A NOR B |
---|---|---|
0 | 0 | 1 |
0 | 1 | 0 |
1 | 0 | 0 |
1 | 1 | 0 |
The truth table for the TRUE (=1) function is:
A | TRUE |
---|---|
0 | 1 |
1 | 1 |
The truth table for the FALSE (=0) function is:
A | FALSE |
---|---|
0 | 0 |
1 | 0 |
Maxterms $ M $ are the product of row numbers of the table which have a logical 0 output (row numbering from 0).
Example: $ X = a \oplus b $ (XOR) the truth table has 2 outputs FALSE at the first and last lines denoted 0, and 3 therefore $ X = \prod{M(0,3)} $
dCode retains ownership of the "Truth Table" source code. Any algorithm for the "Truth Table" algorithm, applet or snippet or script (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or any "Truth Table" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) or any database download or API access for "Truth Table" or any other element are not public (except explicit open source licence like Creative Commons). Same with the download for offline use on PC, mobile, tablet, iPhone or Android app.
Reminder: dCode is an educational and teaching resource, accessible online for free and for everyone.
The content of the page "Truth Table" and its results may be freely copied and reused, including for commercial purposes, provided that dCode.fr is cited as the source.
Exporting the results is free and can be done simply by clicking on the export icons ⤓ (.csv or .txt format) or ⧉ (copy and paste).
To cite dCode.fr on another website, use the link:
In a scientific article or book, the recommended bibliographic citation is: Truth Table on dCode.fr [online website], retrieved on 2025-05-01,