Free online tools to generate, calculate,
convert, format, encode, and play.
 

Truth Table Generator

Enter any boolean expression using variables A-Z. The tool generates a full truth table with all input combinations and evaluates each sub-expression step by step.

Examples:

Supported Operators

OperatorAliasesSymbolDescription
AND&&, &, *True when both operands are true
OR||, |, +True when at least one operand is true
NOT!, ~¬Negates the operand
XOR^True when operands differ
NANDNOT AND
NORNOT OR
XNORXANDTrue when operands are equal
IMPIMPLIES, ->Logical implication (NOT A OR B)
IFF<->If and only if (XNOR)

How It Works

The parser tokenizes your input, then builds an abstract syntax tree (AST) using recursive descent parsing. Operator precedence from highest to lowest: NOT, AND / NAND, XOR / XNOR / IFF, OR / NOR, IMP. Parentheses override precedence as expected.

All variables found in the expression are extracted and sorted. The table shows 2n rows for n variables, covering every possible input combination. Sub-expressions are shown as intermediate columns so you can follow the evaluation step by step.


Boolean Logic Basics

  • AND: Both A and B must be true for A AND B to be true. Used in conjunction logic.
  • OR: At least one of A or B must be true. Used in disjunction logic.
  • NOT: Flips the value. NOT true = false, NOT false = true.
  • XOR: Exclusive OR. True only when inputs differ, used in half-adders and parity circuits.
  • NAND / NOR: Universal gates. Any logic circuit can be built from only NAND or only NOR gates.
  • De Morgan's Laws: NOT (A AND B) = NOT A OR NOT B; NOT (A OR B) = NOT A AND NOT B.

Embed This Util

You can embed this util on your own site as a widget. Adding ?embed=1 to the URL loads a compact version with just the tool itself; no header, menu, or documentation. Paste this snippet into your HTML:


    

Copy snippet Adjust the height to taste.



Feedback

Help us improve this page by providing feedback, and include your name/email if you want us to reach back. Thank you in advance.


Share with