Truth Table Generator: Visualize Boolean Functions

simulator beginner ~7 min
Loading simulation...
2-input AND — 4 rows, 1 output is true

A 2-input AND truth table has 4 rows (2^2). Only the row where both inputs are 1 produces output 1. The remaining 3 rows produce 0.

Formula

Number of rows = 2^N where N = number of inputs
Number of possible N-input functions = 2^(2^N)
Sum of minterms: f = Σm(i) for all rows where f=1

The Complete Map of a Boolean Function

A truth table is the most explicit representation of a Boolean function: it lists every possible input combination alongside the corresponding output. For a function with N inputs, the table has 2^N rows — exhaustively covering every case. Truth tables are how engineers verify that a logic circuit behaves correctly before committing it to silicon.

Reading the Table

Each row represents a binary number counting from 0 to 2^N − 1. The leftmost column is the most significant bit. The output column on the right shows the result of applying the Boolean operation to that row's inputs. Rows where the output is 1 are the function's "on-set" — these define its behavior completely.

Minterms and Canonical Forms

Every row with output 1 corresponds to a minterm — a product of all input variables in direct or complemented form. The sum (OR) of all minterms gives the canonical sum-of-products expression. This representation is unique and can be systematically minimized using Karnaugh maps or the Quine-McCluskey algorithm to produce efficient circuit implementations.

From Truth Tables to Circuits

Once you have a truth table, you can derive the minimal gate-level circuit. Two-level AND-OR implementations follow directly from the sum-of-products form. Multi-level implementations trade depth for gate count. Modern synthesis tools automate this process, converting truth tables and HDL descriptions into optimized netlists for FPGA or ASIC fabrication.

FAQ

How many rows does a truth table have?

A truth table with N input variables has 2^N rows. Two inputs produce 4 rows, three inputs produce 8 rows, and four inputs produce 16 rows. Each row represents one unique combination of input values.

What is a minterm in Boolean algebra?

A minterm is a product term (AND of all variables) that equals 1 for exactly one row of the truth table. For two variables A and B, the minterms are A'B', A'B, AB', and AB. Any Boolean function can be expressed as the OR of its minterms (sum-of-minterms form).

How do you simplify a truth table?

Truth tables can be simplified using Karnaugh maps, the Quine-McCluskey algorithm, or Boolean algebra identities. The goal is to find the minimal sum-of-products or product-of-sums expression that produces the same truth table.

What is the difference between XOR and XNOR?

XOR (exclusive OR) outputs 1 when the inputs differ. XNOR (exclusive NOR) outputs 1 when the inputs are the same. XNOR is the complement of XOR and acts as an equality comparator.

Sources

Embed

<iframe src="https://homo-deus.com/lab/logic-circuits/truth-table/embed" width="100%" height="400" frameborder="0"></iframe>
View source on GitHub