thoughtasylumTOOLBOX Preview

Tools › Developer

Truth Table

Type a boolean expression, in symbols, words or code, to get its truth table, its simplest form and its minterms; type two to check they're equivalent.

About this tool What it's for, how to use it and an example

What it's for

Work out a boolean expression for every combination of its inputs, simplify it, or check that two ways of writing a condition mean the same thing, for logic homework, circuit design or an if statement that has grown hard to read.

For example, before replacing !(isAdmin && isLocked) with !isAdmin || !isLocked in code, type both on separate lines to confirm they agree on every row.

How to use it

Type an expression and the table appears as you type: one column for each variable, in the order they first appear, and a column for the result, with each row counted in binary. Variables are letters or words (A, isAdmin). Operators can be written as symbols, words or code, as listed under the box; from tightest to loosest they are not, and (and nand), xor, or (and nor), implies (which groups from the right), then if and only if. Use brackets when in doubt.

Above the table:

  • Result says whether the expression is always true, never true, or true in some rows.
  • Simplest form is the smallest sum of products (OR of ANDs), worked out with the Quine–McCluskey method, in logic notation; As code writes it with &&, || and !.
  • Rows that are true lists the row numbers (minterms), for a Karnaugh map or a textbook answer.

With several lines, each gets its own column and its own simplest form, and the message says whether they’re equivalent. Copy a link to this input keeps the expressions.

Example

Choose Try an example, which types A & !B | C. And binds tighter than or, so it’s (A ∧ ¬B) ∨ C: true in 5 of 8 rows, the minterms are Σm(1, 3, 4, 5, 7), and as code it’s (A && !B) || C.

Good to know

Up to 12 variables (4,096 rows). The simplest form picks the essential terms and then the term covering the most rows left, which is the smallest answer for a few variables but can, rarely, be a term longer than needed for many; it’s always equivalent. Variables can’t be written next to each other to mean and (AB): use A & B.

And: & ∧ and · Or: | ∨ + or · Not: ! ¬ ~ not or A' · Xor: ^ ⊕ · Implies: -> → · If and only if: <-> ↔ · also nand, nor, 1, 0 and brackets.

Private: this tool runs in your browser. Nothing you type, paste or choose leaves this page.

Saved you a few minutes? Say thanks with a coffee.

Something wrong with this tool, or missing from it? Report a bug or suggest a feature.

↑ ↓ move↵ openesc close