Boolean Logic Tool

Truth Table Generator

Type a Boolean or propositional-logic expression to get its truth table, minterms, Karnaugh map, minimal SOP and POS, and a logic gate diagram.

Any notation: ∧ ∨ ¬, A·B + C′, AND OR NOTKarnaugh map & minimisationRuns in your browser
Boolean expression
Variables are letters or words. Operators: and/&/·, or/|/+, not/!/', xor, nand, nor, ->, <->. AB means A AND B.
Parsed as¬(A ∨ B) ∧ C ∨ A ∧ BContingent
Truth table
3 variables · 8 rows · 3 true
ABCA ∨ B¬(A ∨ B)¬(A ∨ B) ∧ CA ∧ B¬(A ∨ B) ∧ C ∨ A ∧ B
00001000
00101101
01010000
01110000
10010000
10110000
11010011
11110011
Simplified forms
Quine–McCluskey prime implicants with a minimum cover (Petrick's method). Variable order: A, B, C.

Minimal SOP

A'B'C + AB

\overline{A} \land \overline{B} \land C \lor A \land B

Minimal POS

(A + B')(A' + B)(A + C)

(A \lor \overline{B}) \land (\overline{A} \lor B) \land (A \lor C)

Canonical SOP

Σm(1, 6, 7)

Canonical POS

ΠM(0, 2, 3, 4, 5)

Prime implicants (2)

A'B'CAB
Karnaugh map
Gray-code order so neighbouring cells differ by one variable. Dots mark the minimal-SOP term covering each 1.
A\BC00011110
0
m00
m11
m30
m20
1
m40
m50
m71
m61
  • A'B'C1 cell
  • AB2 cells
Logic gate diagram
Two-level AND–OR circuit for the minimal sum-of-products.
ABCA'B'ANDANDORF

What you get from one expression

The truth table is the start; the same input also gives the simplified circuit

Full truth table

Every row for up to 8 variables, with optional columns for each intermediate sub-expression so you can follow how the final value is built.

Flexible notation

Symbolic logic (∧ ∨ ¬ → ↔), Boolean algebra (AB + C′), programming operators (&& || !), or plain words — all parsed with standard precedence.

Minterms & canonical forms

Σm and ΠM lists, tautology and contradiction detection, and canonical sum-of-products / product-of-sums ready to copy.

Karnaugh map

Two- to four-variable maps in Gray-code order with the prime implicants of the minimal solution marked on the cells.

Simplification & gates

Quine–McCluskey with Petrick's method finds a minimal SOP and POS, and the SOP is drawn as a two-level AND–OR gate diagram.

LaTeX, Markdown, CSV

Copy the table as a LaTeX array for a paper, a Markdown table for notes, or CSV for a spreadsheet; simplified forms come with LaTeX too.

How the truth table generator works

A truth table lists the value of a Boolean expression for every combination of its inputs. With n variables there are 2ⁿ rows, conventionally ordered by counting in binary with the first variable as the most significant bit, so row 0 is all false and the last row is all true. The row index is the minterm number: rows where the expression is true are the minterms, rows where it is false are the maxterms. This tool parses your expression into a syntax tree, evaluates that tree once per row, and also evaluates each internal node so it can show the intermediate columns that make hand-checking easy.

The parser accepts the notations used in discrete mathematics, digital logic, and programming interchangeably. NOT binds tightest, then AND, XOR, OR, implication, and finally the biconditional; implication associates to the right, matching the usual textbook convention. Writing two variables next to each other (AB) or a prime after a term (A′) follows Boolean-algebra style, while words like rain and umbrella are treated as single propositional variables. The “parsed as” line shows the tree the tool actually built, which is the fastest way to catch a missing pair of parentheses.

Simplification uses the Quine–McCluskey algorithm. Minterms are grouped by their number of ones and repeatedly merged whenever two differ in exactly one bit, producing terms with don’t-care positions; anything that can no longer merge is a prime implicant. A prime-implicant chart then shows which minterms each covers. Essential prime implicants are taken first, and Petrick’s method resolves the remaining cover exactly, choosing the fewest terms and, on ties, the fewest literals. Running the same procedure on the maxterms and complementing each term gives the minimal product-of-sums.

The Karnaugh map is the visual form of the same idea. Cells are arranged in Gray-code order so that horizontal and vertical neighbours — including cells that wrap across an edge — differ in one variable. A rectangular block of 2ᵏ ones is a product term with k variables eliminated. The coloured dots on the map correspond to the minimal-SOP terms, so you can verify by eye that every 1 is covered and that no group could be enlarged. For five or more variables the map becomes hard to read, so the tool reports the algebraic result only.

The gate diagram renders the minimal SOP as a standard two-level AND–OR network: inverters on any complemented literal, one AND gate per product term, and a single OR gate collecting the terms. It is the circuit a digital-logic course expects you to draw from a simplified expression, and a useful sanity check that the literal count in the algebra matches the wiring.

Built and maintained by the runcell.dev team. Last reviewed September 2026.

Frequently Asked Questions

Related tools

More browser-based tools for math, logic, and code

Pseudocode Generator
Turn a description of an algorithm into LaTeX pseudocode.
Slope Field Generator
Plot direction fields and solution curves for dy/dx = f(x, y).
Curl to Python
Convert a curl command into Python requests code.