Your country

Tools that support it use your country for local currency, number formats, units and paper size. Your choice is saved only in this browser.

Type a name or a two-letter code. Use the up and down arrow keys to move through the countries, Enter to choose one and Escape to close.

Truth Table Generator

Type any logic expression and get its truth table, its minimal form and the working.

Math No upload Works offline Free preview, no sign-upIncluded in your pass Pro tool Pro pass: ₹179 for 30 days

Try before you buy.

  • Free preview: the variables of your expression and the inputs of the first rows of its truth table (up to 3), with every value, the classification and the forms hidden.
  • Locked until you unlock it: download and copy.
  • Unlock: Pro pass, ₹179 for 30 days, a one-time payment that never renews.

Ways to unlock shows how to get the full result.

See passes (opens in a new tab)

Printing this result is locked in the free preview.

Variables are letters (p, q, A, x1). NOT: ¬ ~ ! or a prime A′; AND: ∧ & · * ^ or AB; OR: ∨ | +; XOR: ⊕ or xor; → (->, implies); ↔ (<->, iff); NAND ↑; NOR ↓; 1 and 0 (or true, false). NOT binds tightest, then AND, XOR, OR, → and ↔.

Show values as
First row
Try:

Result

Classification

Next steps

About the Truth Table Generator

Type a logic expression — with symbols such as ¬ ∧ ∨ ⊕ → ↔, with words such as NOT, AND, OR, IMPLIES, or in the algebra notation of digital electronics such as AB + C′ — and get its truth table for up to 10 variables, with a column for every sub-expression so you can follow how each row is worked out. The page says whether the expression is a tautology, a contradiction or a contingency, and can check whether two expressions are logically equivalent, showing a row where they differ if they are not.

It also gives the canonical forms (the minterms Σm and maxterms ΠM, as a canonical sum of products and product of sums), the minimal sum of products and product of sums by the Quine–McCluskey method with Petrick’s method, and the Karnaugh map for up to 6 variables with each group marked. A function can also be entered by its minterms and don’t-care rows.

How to use it

  1. Type the expression, or use the symbol buttons. Single letters (with optional numbers, such as x1) are variables, and two letters side by side mean AND: AB is A ∧ B.
  2. To test an equivalence, type a second expression under Compare with, such as ¬p ∨ ¬q next to ¬(p ∧ q).
  3. Choose how values are shown (T/F or 1/0), whether the table starts with the all-true or the all-false row, and the notation of the simplified forms.
  4. Read the classification, the table, the minimal forms and the Karnaugh map; choose a group under the map to see which cells it covers, and follow the Quine–McCluskey steps.
  5. Copy the table or the minimal form, or download the table as a CSV file — with a Pro pass or after unlocking this result; without one you see the free preview.

Examples

Modus ponens
Input
((p → q) ∧ p) → q
Result
Tautology: true in all 4 rows
De Morgan’s law
Input
¬(p ∧ q) compared with ¬p ∨ ¬q
Result
Equivalent in all 4 rows
A statement and its converse
Input
p → q compared with q → p
Result
Not equivalent: they differ when p = F, q = T
Simplify a sum of products
Input
A′B + AB′ + AB
Result
Minimal SOP: A + B

Minterms 1, 2 and 3; the two prime implicants A and B cover them all.

Minterms with don’t-cares
Input
f(A, B, C, D) = Σm(4, 8, 10, 11, 12, 15) + d(9, 14)
Result
Minimal SOP with 3 terms: AB′ + AC + BC′D′

BC′D′ and AC are essential; minterm 8 is then covered by AB′ (AD′ would do as well).

Common uses

  • Checking logic and discrete-maths homework: truth tables, tautologies, contradictions and equivalences.
  • Simplifying the Boolean function of a digital circuit to the fewest gates with a Karnaugh map or Quine–McCluskey.
  • Verifying that a refactored condition in code (if statements, filters) means the same as the original.
  • Writing canonical sum-of-products and product-of-sums forms from a list of minterms and don’t-cares.

Operators and how tightly they bind

  • NOT ¬p (also ~p, !p, NOT p, or p′ after the variable) is true when p is false.
  • AND p ∧ q (p & q, p · q, p * q, pq, p ^ q, p AND q) is true when both are true.
  • OR p ∨ q (p | q, p + q, p OR q) is true when at least one is true; XOR p ⊕ q (p xor q) when exactly one is.
  • NAND p ↑ q and NOR p ↓ q are the negations of AND and OR.
  • Implication p → q (p -> q, p implies q, if p then q) is false only when p is true and q is false; biconditional p ↔ q (p <-> q, p iff q) is true when both have the same value.

Without brackets, NOT binds tightest, then AND (and NAND), XOR, OR (and NOR), →, and ↔ last; → groups to the right, so p → q → r means p → (q → r). Brackets always make an expression clear. Note that ^ means AND here (it looks like ∧); for exclusive or write ⊕ or xor.

Canonical and minimal forms

Each row of a truth table with n variables has a number from 0 to 2ⁿ − 1, reading the variables as binary digits with the first as the most significant. The rows where the function is true are its minterms: the canonical sum of products ORs one product (a term with every variable) per minterm, and Σm(…) lists their numbers. The false rows are the maxterms: the canonical product of sums ANDs one sum per maxterm, ΠM(…).

The Quine–McCluskey method finds the simplest forms systematically: it groups the minterms (and any don’t-cares) by their number of 1s, merges pairs that differ in one bit until nothing more merges — what is left are the prime implicants — and then chooses a cover of all the minterms from the prime implicant chart: first the essential ones (the only cover of some minterm), then, with Petrick’s method, the cheapest combination of the rest (fewest terms, then fewest literals) — multiplied out when it is short, and otherwise found by a systematic branch-and-bound search over the same product of sums. A Karnaugh map shows the same thing visually: rows and columns in Gray-code order, so the cells of each prime implicant form a rectangle of 1, 2, 4 or 8 cells, wrapping round the edges.

Limitations

  • Up to 10 variables (1,024 rows); the table shows the first 256 rows until you ask for all of them. Karnaugh maps are drawn for up to 6 variables.
  • Variable names are single letters, optionally followed by a number (A, p, x1, x_2), because letters written side by side mean AND. Words such as AND, OR, NOT, XOR, NAND, NOR, IMPLIES and IFF are operators, so they cannot be variable names.
  • Several different minimal forms can exist; the page gives one with the fewest terms and, among those, the fewest literals.
  • For big functions (usually 8 to 10 variables with hundreds of prime implicants) the search for the cheapest cover stops at a time limit: the page then says so and shows the smallest cover it found, which may not be the minimum. Every form it shows agrees with the truth table in every row.
  • This is propositional logic only: quantifiers (∀, ∃) and predicates are not supported.

Privacy

Everything happens in your browser. What you enter or open here is not uploaded or stored by MySmartCoPilot.

Frequently asked questions

What do I get without a pass?

Without a pass, Truth Table Generator shows the variables of your expression and the inputs of the first rows of its truth table (up to 3), with every value, the classification and the forms hidden. Until you unlock it, the result can’t be downloaded or copied. A Pro, Premium or Ultimate pass, a one-time payment that never renews, unlocks the full result. The pricing page lists the passes and their prices.

How many rows does a truth table have?

2ⁿ for n variables: 4 rows for 2 variables, 8 for 3, 16 for 4 and 1,024 for 10. Each row is one combination of true and false values.

How do I know if an expression is a tautology?

Build its truth table: it is a tautology if the final column is true in every row, a contradiction if it is false in every row, and a contingency otherwise. ((p → q) ∧ p) → q, modus ponens, is a tautology.

How do I check whether two statements are logically equivalent?

They are equivalent when their truth tables agree in every row, which is the same as saying that A ↔ B is a tautology. Type one expression and the other under Compare with: the page checks every row over both sets of variables and shows a row where they differ if they are not equivalent.

Why is p → q true when p is false?

An implication only promises that q holds when p does. If p is false, the promise is not broken, so the implication counts as true (it is vacuously true). It is false only in the row where p is true and q is false.

What is the difference between SOP and POS?

A sum of products (SOP) ORs together AND terms, such as AB + C′; a product of sums (POS) ANDs together OR terms, such as (A + B)(A′ + C). Both can describe any function. SOP is built from the true rows (minterms) and POS from the false rows (maxterms).

What are don’t-cares?

Rows whose value does not matter, for example input combinations that can never happen. In a Karnaugh map or Quine–McCluskey they may be treated as 1 or 0, whichever gives a simpler form. Enter them with the minterms, such as Σm(4, 8, 10, 11, 12, 15) + d(9, 14).

Quick answers and tool search

Type to search tools or to get a quick answer, for example 18% of 2500. Use the up and down arrow keys to move through the results, Enter to choose, and Escape to close.