StringMash.com

Truth table generator

Type an expression and get every row, plus the minterms and the simplest form.

9 characters
Updates as you type
SimplifiedAC' + BC'
MintermsΣm(2, 4, 6)
MaxtermsΠM(0, 1, 3, 5, 7)
Truth table column00101010
Product of sums(A + B + C)(A + B + C')(A + B' + C')(A' + B + C')(A' + B' + C')
The Karnaugh map is drawn below for two to four variables

Show the steps
A\BC00011110000010312114050716
  1. Variables: A, B, C. 8 rows, one for each way to set them.
  2. F is 1 on rows 2, 4, 6. Those are the minterms; the rows where F is 0 are the maxterms.
  3. Quine–McCluskey: pair up minterms that differ in one variable, again and again, until nothing pairs. What's left are the prime implicants: BC' (2,6), AC' (4,6).
  4. Essential: BC', AC', each the only one covering some minterm.
  5. Minimal sum of products: AC' + BC'. Other answers of the same size can exist when a map has a choice of groups.

Making a truth table

Type an expression and the table appears, one row for every way to set the variables. Variables are in alphabetical order, the first one is the most significant bit, and rows count up in binary from all zeros, the order most textbooks use. F is the expression's value on that row.

Above the table you get the simplified form, the row numbers where F is 1 (minterms) and where it's 0 (maxterms), and the output column as one string of bits, handy for comparing two expressions: if the strings match, the expressions are equivalent.

Writing an expression

Type it the way your course writes it. AND can be `·`, `*`, `&`, `&&`, `∧` or the word AND, or nothing at all, so `AB` and `A(B + C)` are ANDs. OR is `+`, `|`, `||`, `∨` or OR. NOT is a `'` after a term, as in `A'` or `(A + B)'`, or `!`, `~`, `¬` or NOT before it. XOR is `^`, `⊕` or XOR, and NAND, NOR and XNOR work as words. `0` and `1` are constants.

Single letters are variables, so `abc` means a AND b AND c. A name with a digit, mixed case or more than four letters stays whole, so `x1`, `Rain` and `sprinkler` each count as one variable. Up to eight variables fit, a table of 256 rows.

Checking whether two expressions are equal

Two expressions are equal when their truth tables match row for row. Type each in turn and compare the Truth table column rows. Or type `(first) XNOR (second)`. If the expressions are equal, every row of that table is 1 and the working says it's a tautology. This is how you check De Morgan's law, for instance. `(AB)' XNOR (A' + B')` is always true.

How many rows

Each variable doubles the table. Two variables give 4 rows, three give 8, four give 16, and eight give 256. Past that, a table stops being a useful way to look at a function, which is why logic designers switch to maps and algebra.

Which operator goes first

NOT binds tightest, then AND, then XOR, then OR. So `A + BC'` means A OR (B AND (NOT C)). Brackets override it as usual. NAND sits with AND and NOR with OR, and a chain of them is read left to right, which matters because NAND and NOR aren't associative: `(A NAND B) NAND C` isn't the same as `A NAND (B NAND C)`. Bracket chains of them to be sure.

Questions

How do you make a truth table?

List every combination of the variables, counting up in binary, then work out the expression for each row. This generator does both from the expression you type.

How many rows does a truth table have?

2 to the power of the number of variables: 8 rows for three variables, 16 for four.

Can it do XOR and NAND?

Yes. Use ^ or the word XOR, and the words NAND, NOR and XNOR.

What's a tautology?

An expression that's true on every row, such as A + A'. Its opposite, false on every row, is a contradiction.

Sources

Added . What's new