Truth Table Generator

A truth table is the complete map of how a logic expression behaves, listing every possible combination of true and false for its variables alongside the result, and this generator builds one for you from any boolean expression you type. Enter something like (A AND B) OR NOT C using single capital letters for the variables and the operators AND, OR, NOT and XOR, and it works out which variables you have used, lays out all the combinations, and evaluates the expression for each row. With one variable there are two rows, with two variables four, with three eight, and so on, doubling each time, which is exactly why a table is so useful: it guarantees you have checked every case rather than reasoning about them in your head. The four core operators cover the whole of basic logic. AND is true only when both inputs are true, OR is true when at least one is, NOT flips a value to its opposite, and XOR, the exclusive or, is true only when the two inputs differ. Brackets let you control the order of evaluation so the expression means exactly what you intend. This makes the tool genuinely useful for computer science and digital electronics students learning boolean algebra and logic gates, for checking that two expressions are equivalent by comparing their tables, for simplifying circuits, and for anyone designing or debugging conditional logic in programming. Because the whole table regenerates as you type, you can experiment with different expressions and immediately see how adding a NOT or swapping an AND for an OR changes every outcome, which builds real intuition for how logic fits together. The operators and a worked example are explained clearly below.

Calculate.co.nz is proud to be partnered with Premium Homes, a recognised leader in eco-friendly, sustainable, and energy-efficient homebuilding. With a dedicated team and award-winning experience, they create homes that prioritise health, comfort, and long-term performance. Their founders, Andrew and Kelly, set out to raise the standard of residential construction in New Zealand by combining practical building expertise with a clear commitment to doing things better for homeowners.
Calculate.co.nz partner: Premium Homes
Advertise on this page
Examples: A AND B A OR (B AND NOT C) A XOR B NOT (A AND B) (NAND)

How it works

The generator reads your expression, identifies the single-letter variables, and lists every combination of true (T) and false (F) for them, 2 to the power n rows for n variables. It then evaluates the expression for each row using standard logic: AND is true only if both sides are true, OR if either is, NOT inverts, and XOR is true only when the sides differ. Use brackets to control the order.

Worked example

For A AND B there are two variables and four rows. The result is true only in the single row where both A and B are true, and false in the other three. Adding OR NOT C introduces a third variable and doubles the table to eight rows, with the result also true wherever C is false.

Related calculators