Truth Table Calculator: Boolean Expressions, SOP, POS and Karnaugh Maps
By FindMySum · Last reviewed
A truth table calculator lists the output of a Boolean expression for every combination of its inputs. This one goes further: it reads the expression in either logic or digital-design notation, lists the minterms and maxterms, writes the canonical sum of products and product of sums, and simplifies the function to its minimal SOP and POS forms with the Quine–McCluskey method. For up to four variables it draws the Karnaugh map, and it can show the output of each gate for one input. You can also start from a list of minterms and don't-cares, which turns it into a K-map solver.
Reading a Boolean expression
Boolean algebra has two values, 0 (false) and 1 (true), and three basic operations:
- NOT (complement), written A′, ¬A or ~A: 1 becomes 0 and 0 becomes 1.
- AND, written AB, A·B or A ∧ B: 1 only when both inputs are 1.
- OR, written A + B or A ∨ B: 1 when at least one input is 1.
Derived operations are XOR (1 when the inputs differ), XNOR (1 when they are equal), NAND and NOR (AND and OR followed by NOT), implication A → B (false only when A = 1 and B = 0) and equivalence A ↔ B. Without brackets, NOT is applied first, then AND, then XOR, then OR, so AB + A′C means (A AND B) OR ((NOT A) AND C).
Minterms, maxterms and canonical forms
Number the rows of the truth table by reading the inputs as a binary number, first variable most significant. Each row where F = 1 is a minterm, written as a product that is 1 on that row only: row 6 of a three-variable table, ABC = 110, is the minterm ABC′. ORing all the minterms gives the canonical sum of products, F = Σm(…).
Each row where F = 0 is a maxterm, a sum that is 0 on that row only: row 0, ABC = 000, gives (A + B + C). ANDing all of them gives the canonical product of sums, F = ΠM(…). The two lists are complements of each other: every row is either a minterm or a maxterm (or a don't-care).
Simplifying: Karnaugh maps and Quine–McCluskey
Canonical forms are long. Simplification merges terms that differ in a single variable, using the identity XY + XY′ = X. On a Karnaugh map the rows and columns are labelled in Gray code (00, 01, 11, 10), so neighbouring cells differ in one bit and mergeable minterms sit next to each other, including across the edges. Circling the largest power-of-two rectangles of 1s gives the prime implicants.
The Quine–McCluskey method does the same merging in tables, which works for any number of variables and is how this calculator simplifies:
- List the minterms and don't-cares in binary.
- Merge every pair that differs in one bit, marking the differing bit with a dash. Repeat with the merged terms until nothing merges. Terms never merged are the prime implicants.
- Pick the essential prime implicants: those that are the only cover for some minterm.
- Cover the remaining minterms with as few further prime implicants as possible, then as few literals as possible.
The minimal product of sums comes from doing the same with the 0s and complementing the variables.
Worked example: F = AB + A′C
The calculator opens with this expression.
- Truth table: AB is 1 on rows 6 and 7; A′C on rows 1 and 3. So F = Σm(1, 3, 6, 7), and the maxterms are 0, 2, 4 and 5.
- Prime implicants: merging gives A′C (rows 1, 3), BC (rows 3, 7) and AB (rows 6, 7).
- Essential: row 1 is covered only by A′C and row 6 only by AB, so both are essential. Together they cover every minterm, and BC is redundant (it is the consensus term of the other two).
- Result: the minimal SOP is AB + A′C, and from the 0s the minimal POS is (A′ + B)(A + C).
Don't-cares
Some input combinations never occur. A circuit that takes a decimal digit in BCD only sees the codes 0 to 9, so codes 10 to 15 are don't-cares. Marking them lets the simplifier treat each as a 1 when that makes a group larger, and ignore it otherwise, which often gives a much simpler circuit. In minterm mode, list them in the don't-care box; they appear as X on the map.
Gate by gate
Give one input combination in "Evaluate at", such as 011 for A = 0, B = 1, C = 1, and the calculator lists every NOT, AND, OR or other gate in the expression with its output, in the order a signal would pass through a circuit. It is a quick way to trace why a circuit gives the output it does.
Limits
The calculator handles one output and up to six single-letter variables. It doesn't minimise several outputs together, convert to NAND-only or NOR-only circuits, draw circuit diagrams or analyse timing hazards. When a function has more than one minimal form, it shows one.
More questions
How many rows does a truth table have?
2ⁿ for n variables, because each variable can be 0 or 1 independently: 4 rows for 2 variables, 8 for 3, 16 for 4 and 64 for 6. That doubling is why truth tables and Karnaugh maps become impractical by hand beyond 5 or 6 variables, and why computer methods such as Quine–McCluskey are used instead.
What is the difference between a truth table in logic and in digital electronics?
None in substance. Logic courses write true and false with ∧, ∨, ¬ and →; digital design writes 1 and 0 with AND, OR, NOT gates and the notation AB + A′C. The calculator accepts both notations and gives the same table.
What are De Morgan's theorems?
(AB)′ = A′ + B′ and (A + B)′ = A′B′: the complement of an AND is the OR of the complements, and the complement of an OR is the AND of the complements. They let you move a NOT through brackets and convert between NAND/NOR circuits and AND/OR circuits.
What is a prime implicant?
A product term that implies the function (it is 1 only where F is 1 or don't-care) and can't be made smaller by removing a literal. On a Karnaugh map it is a largest possible rectangle of 1s whose size is a power of 2. An essential prime implicant is one that is the only cover for some minterm, so every minimal expression must include it.
Why does the order of the variables matter in a truth table?
It sets the row numbers. With A as the most significant bit, the row A = 1, B = 1, C = 0 is binary 110, minterm 6. Listing the variables as C, B, A instead reads the same row as 011, minterm 3, so the minterm list changes even though the function doesn't. The calculator orders variables alphabetically, first letter most significant.
Sources
- Mano, M. M. & Ciletti, M. D. (2018). Digital Design: With an Introduction to the Verilog HDL, VHDL, and SystemVerilog, 6th ed. Pearson
- McCluskey, E. J. (1956). Minimization of Boolean Functions. Bell System Technical Journal 35(6):1417–1444
- Karnaugh, M. (1953). The Map Method for Synthesis of Combinational Logic Circuits. Transactions of the AIEE, Part I 72(5):593–599
This article explains how the calculator works and is general information, not financial, tax, legal or medical advice. Rules change; check the sources above or a qualified professional before you act.