Best Truth Table Generator |How Truth Tables Work

How Truth Tables Really Work

A truth table looks like homework busywork until you notice what it is: the complete, unambiguous specification of a circuit. Every minterm, every Karnaugh map, every NAND-only implementation and every satisfiability question starts from that grid of ones and zeros. Here is the theory underneath it.

Truth Table Generator

Last updated: July 2026

🔴 A truth table is a complete specification, not a summary

Boolean algebra deals with variables that can hold exactly two values. Because the set of inputs is finite, you can do something you can almost never do in ordinary mathematics: list every case. With three inputs there are eight possible combinations, with four there are sixteen, and in general n inputs give 2 to the power of n rows. Write down the output for each of those rows and you have not described the circuit, you have defined it. Two circuits with identical truth tables are the same function, however differently they are drawn.

Prime Tool Hub Video Tutorial — Watch on YouTube

The row order is not decorative either. Reading the input columns left to right as binary digits gives each row a number: the row where A=1, B=0, C=1 is binary 101, which is row five. Those indices become the shared vocabulary of digital logic. When a textbook writes Σm(0, 2, 5, 7) it is pointing at rows zero, two, five and seven of exactly this table, and a Karnaugh map cell address means the same thing. If binary place value is hazy, our guide to number base conversion covers how those row numbers are constructed.

One important boundary: this only works for combinational logic, where the output depends purely on the inputs present right now. The moment a circuit feeds its own output back into itself, as a flip-flop does, it gains memory and the same inputs can produce different outputs depending on history. A truth table cannot capture that, which is why sequential circuits are described with state diagrams instead.

🟡 Minterms and maxterms: reading the same table two ways

Diagram showing minterms taken from output ones and maxterms from output zeros

Once the table exists there are two honest ways to turn it back into an expression, and they are mirror images. The first looks only at the rows where the output is 1. Each such row can be captured by a single product term that is true for that row and nothing else: take each variable plain if its value in that row is 1, and complemented if it is 0. That term is a minterm. Chain all the minterms together with OR and you have an expression that is true on exactly those rows and false everywhere else. This is the canonical sum-of-products.

The second way looks at the rows where the output is 0 and builds a sum term that is false only on that row, taking each variable plain if its value is 0 and complemented if it is 1. That is a maxterm, and ANDing them all gives the canonical product-of-sums. Both describe the same function. The reason both exist is practical: if a function is mostly ones, the maxterm form is shorter, and if it is mostly zeros, the minterm form is.

Notice the word canonical. These forms are complete, not compact. Every term names every variable, which is precisely what makes them mechanical to derive and precisely why nobody builds circuits from them directly. Minimisation, whether by Karnaugh map grouping or by the Quine-McCluskey algorithm, is the separate step that squeezes the canonical form down to something you would actually wire. Deriving the minterms first, then minimising, is the standard order of work.

🟢 Functional completeness: why NAND alone is enough

NAND gate arrangements forming NOT, AND and OR gates

Here is a result that sounds impossible until you see it. Every Boolean function that any truth table can express, no matter how many variables or how tangled, can be built from NAND gates and nothing else. The same is true of NOR gates. A set of operators that can express every possible function is called functionally complete, and NAND on its own qualifies.

The sketch of the proof is short. Any function can be written as a canonical sum-of-products, so if you can build NOT, AND and OR from NAND, you can build anything. NOT comes free: feed the same signal into both inputs of a NAND and you get the inverse. AND is a NAND followed by that inverter. OR follows from De Morgan’s law, since A OR B is the same as NOT(NOT A AND NOT B), which is a NAND of two inverted inputs. Three constructions, and the whole of digital logic falls out. The formal treatment lives on Wikipedia’s functional completeness page.

🟢 Why manufacturers cared

🔵 A fab that masters one gate can build any chip, so NAND became the workhorse of CMOS production.
🟠 Uniform gates mean uniform timing and predictable propagation delay across a design.
🟣 It is no accident the very first part in the 7400 family, the 7400 itself, is four NAND gates in one package.

🔴 Tautologies, contradictions, and the exponential wall

Three labels classify any expression by looking down its output column. If every row is 1 it is a tautology, always true regardless of input. If every row is 0 it is a contradiction, satisfiable by nothing. Anything in between is a contingency, and in circuit terms only contingencies are interesting, because a tautology is a wire tied high and a contradiction is one tied low.

The related question, “is there any input combination that makes this expression true?”, is called Boolean satisfiability, and it is far deeper than it looks. Checking it by building the whole table costs 2 to the power of n rows, so twenty variables is a million rows and sixty variables outruns any computer that will ever exist. Satisfiability was the first problem proven NP-complete, and no method fundamentally cheaper than exponential search is known for the general case. The Wikipedia entry on the satisfiability problem traces that history. This is the honest reason a browser truth table tool stops at eight variables: not laziness, but the shape of the mathematics.

A quieter idea hides in the same output column. A variable is redundant when flipping it never changes the output for any assignment of the others. Algebraically its terms have cancelled; physically it is an input pin driving nothing. Spotting redundant variables early removes gates, traces and cost before a board is ever etched.

🟡 Why the parser matters, and why the work should stay local

There is a shortcut that many web-based logic tools take. Rather than writing a parser, they rewrite your expression into JavaScript operators and hand the result to the language’s built-in code evaluator. It works, right up until it does not. Substituting AND for an ampersand with a naive text replacement will happily corrupt the word NAND, because NAND contains AND, and the tool then fails on the very gates a student most needs. Worse, passing user text into a code evaluator is the classic injection surface, which is why MDN’s own documentation warns against it and why a strict Content Security Policy blocks it outright. The reasoning is laid out in MDN’s note on eval and its dangers.

A purpose-built tokeniser avoids both problems. It reads NAND as one indivisible token rather than as N plus AND, it enforces the real precedence of NOT over AND over XOR over OR, and it never turns text into executable code. That design choice also lets the whole thing run offline, which matters more than it first appears. A circuit expression can be coursework under an academic integrity policy, or the proprietary control logic of a product not yet announced. Neither belongs in a request body sent to somebody else’s server.

Put together, the workflow that these ideas imply is unglamorous and effective. Specify the behaviour as a truth table, read off the minterms, minimise them with a Karnaugh map, check the simplified expression against the original row by row, then convert to NAND or NOR for the technology you are building on. Each stage has a tool, and each stage is a place where a mistake is cheap to find. You can walk that path in the Truth Table Studio, which builds the table, derives the canonical forms, and checks equivalence entirely in your browser.

❓ Frequently Asked Questions

Why does a truth table have 2ⁿ rows?

Each input can be 0 or 1 independently, so n inputs give two choices multiplied n times. Three inputs give eight rows, four give sixteen, and the count doubles with every variable added.

What exactly is a minterm?

A product term that is true for exactly one row of the table. Each variable appears once, plain if its value is 1 in that row and complemented if it is 0. ORing the minterms rebuilds the function.

When would I choose maxterms over minterms?

When the output is mostly ones. Maxterms describe the zero rows, so a function with few zeros gets a shorter product-of-sums than its sum-of-products equivalent.

Is canonical the same as simplified?

No, and the difference matters. Canonical forms name every variable in every term. Minimisation with a Karnaugh map or Quine-McCluskey is a separate step that shrinks them into something worth building.

Can every circuit really be built from NAND gates?

Yes. NAND can produce NOT, AND and OR, and since any function has a sum-of-products form, those three suffice to build anything. NOR is universal for the same reason.

What is a tautology in circuit terms?

An expression whose output is 1 on every row. As hardware it is simply a wire tied to logic high, so encountering one usually means a typo rather than a design.

Why do tools cap the variable count?

Because rows double with each variable. Twenty variables is over a million rows. Boolean satisfiability is NP-complete, so no general shortcut avoids that exponential growth.

Can truth tables describe flip-flops?

No. Flip-flops have memory, so the same inputs can give different outputs depending on the previous state. Sequential logic needs state diagrams and characteristic tables instead.

Why avoid eval in a logic parser?

Naive text substitution corrupts operators like NAND, which contains AND, and feeding user text to a code evaluator is a known injection risk that a strict Content Security Policy will block anyway.

Choose a language

Top Tools Ranking

Network Total Views
7,547
Tracking Since
Jul 9, 2026

Click any tool to open in a new window