Skip to main content

Boolean Function & Logic Gate Calculator

Evaluate boolean expressions, generate full truth tables, Karnaugh maps (K-Maps), minterms (SOP), and maxterms (POS).

Operators: & · * AND · | + OR · ^ XOR · ! ~ NOT · A' postfix NOT. Juxtaposition means AND, so AB = A & B.

Interactive testbench

Output = 0
Truth table for the entered Boolean expression
#ABCOutput
m00001
m10010
m20101
m30110
m41001
m51010
m61101
m71111

Boolean Function & Logic Gate Calculator: how it works

A truth table, a Karnaugh map and a minimal sum of products are three views of the same function. Getting from an expression to all three is mechanical once the parsing is right.

Operator precedence

Minterms and canonical forms

A minterm is a row of the truth table where the function outputs 1, written as a product in which each variable appears once, complemented where its value is 0. The canonical sum of products is the OR of all minterms.

Worked example · Majority function of three variables

Given

  • F = AB + BC + AC
  • Output is 1 when at least two inputs are 1

Working

  1. 1Truth table gives 1 at rows 3, 5, 6, 7
  2. 2Canonical SOP = A′BC + AB′C + ABC′ + ABC
  3. 3Minimised by Quine–McCluskey

Minimal SOP: AB + AC + BC — six literals rather than twelve

Quine–McCluskey minimisation

The algorithm combines minterms differing in exactly one bit, repeating until no further combination is possible. What remains are the prime implicants. Essential prime implicants are then selected, and Petrick’s method resolves any remaining cover.

Unlike Karnaugh maps, which rely on visual grouping and become impractical beyond four or five variables, Quine–McCluskey is systematic and works for any number of variables.

Karnaugh map ordering

K-map rows and columns follow Gray code — 00, 01, 11, 10 — rather than binary counting order. This ensures adjacent cells differ in exactly one variable, which is what makes visual grouping valid.

Frequently asked questions

NOT binds tightest, then AND, then XOR, then OR. So A + B·C means A OR (B AND C).

More in Engineering & Construction