Skip to main content

Boolean Function & Logic Gate Calculator

Evaluates logic expressions and produces the truth table, K-map, SOP minterms and POS maxterms in one place.

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 K-map and a simplified sum of products are three views of the same function. Once the expression is read correctly, producing all three is mechanical.

Operator precedence

Minterms and canonical forms

A minterm is a truth-table row where the output is 1, written as an AND of every variable once, with a bar over any variable that is 0 in that row. OR-ing all the minterms gives the canonical sum of products.

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 method merges minterms that differ in exactly one bit, and keeps going until nothing more can be merged. The terms left are the prime implicants. The essential ones are picked first, and Petrick’s method settles the rest of the cover.

K-maps depend on spotting groups by eye and become unworkable past four or five variables. Quine–McCluskey is step-by-step and handles any number of variables.

Karnaugh map ordering

K-map rows and columns are ordered in Gray code (00, 01, 11, 10), not normal binary order. That way neighbouring cells differ in only one variable, which is what makes grouping them valid.

Frequently asked questions

NOT is applied first, then AND, then XOR, then OR. So A + B·C means A OR (B AND C).

More in Engineering & Construction