Boolean Algebra Calculator

Logic expression & truth table

Enter a Boolean expression and this tool will parse it, detect the variables, generate the full truth table (for up to 8 variables), evaluate the expression for any TRUE/FALSE assignment and derive the canonical sum-of-products (SOP) and product-of-sums (POS) forms. Designed for digital logic design, computer science courses and quick identity checks.

expression parser truth table canonical SOP & POS digital logic & gates

Boolean expression input & analysis

Variables can be names like A, B, X1. Supported operators: NOT ! ~ ¬, AND & · *, OR + | , XOR ^ , plus parentheses ( ). Implied products like AB are not supported – write A & B.

Cap on displayed rows (2^n). For 8 variables, 2^8 = 256.

If the expression has more variables than this, only evaluation is shown.

Outputs

What is Boolean algebra?

Boolean algebra is an algebraic system with two values, usually \(0\) and \(1\) or \(\text{FALSE}\) and \(\text{TRUE}\), and a set of operations such as AND, OR and NOT. It provides the mathematical foundation for digital logic, switching circuits, logic gates and many areas of theoretical computer science.

Basic operations

  • NOT (\(\lnot A\), \(\overline{A}\), !A): inverts the truth value.
  • AND (\(A \land B\), A & B): true only if both inputs are true.
  • OR (\(A \lor B\), A + B): true if at least one input is true.
  • XOR (\(A \oplus B\), A ^ B): true if exactly one input is true.

Core laws of Boolean algebra

  • Idempotent: \(A + A = A\), \(A \cdot A = A\).
  • Commutative: \(A + B = B + A\), \(A \cdot B = B \cdot A\).
  • Associative: \((A + B) + C = A + (B + C)\), \((A \cdot B) \cdot C = A \cdot (B \cdot C)\).
  • Distributive: \(A \cdot (B + C) = A B + A C\), \(A + B C = (A + B)(A + C)\).
  • Identity: \(A + 0 = A\), \(A \cdot 1 = A\).
  • Complementarity: \(A + \overline{A} = 1\), \(A \cdot \overline{A} = 0\).

De Morgan’s laws

\[ \overline{A \cdot B} = \overline{A} + \overline{B}, \qquad \overline{A + B} = \overline{A} \cdot \overline{B}. \]

These identities are fundamental when transforming logic circuits or simplifying expressions, especially when going between AND/OR and NAND/NOR implementations.

Truth tables and canonical forms

A truth table lists all possible combinations of variable assignments (rows) and the corresponding value of the Boolean function. From the rows where the function is \(1\) or \(0\) we can systematically construct canonical expressions.

  • Canonical sum-of-products (SOP): OR of minterms – each minterm is an AND of all variables or their complements that yields \(1\).
  • Canonical product-of-sums (POS): AND of maxterms – each maxterm is an OR of all variables or their complements that yields \(0\).

Typical use cases

  • Digital circuits – derive logic gate implementations from truth tables.
  • Verification – check whether two different-looking logic expressions are equivalent.
  • Coursework – support for exercises in digital logic, computer architecture, and discrete mathematics.
  • Design documentation – keep a canonical representation of control logic for review.

Related logic & algebra tools