Boolean Algebra Lab

Type a logic expression and get it all: truth table, minimal simplification (Quine–McCluskey SOP/POS), Karnaugh map, a logic-gate diagram, NAND/NOR-only conversions and a binary evaluator. For electronics, digital logic and programming.

Calculator Electronics Updated Oct 16, 2026
How to Use
  1. Type a Boolean expression using letters as variables (case is ignored, so a and A are the same input). Use the words AND OR NOT XOR NAND NOR XNOR or symbols: &, * or · for AND, + or | for OR, !, ~ or an apostrophe after a letter for NOT, and ^ for XOR. AB means A AND B.
  2. Pick a view: Truth table, Simplify (minimal SOP and POS), Karnaugh map, Gate diagram, NAND / NOR or Evaluate.
  3. Simplify shows the minimal sum-of-products, the minimal product-of-sums and how many literals were saved. For the default A AND (B OR NOT C) it gives AC′ + AB and (B + C′)(A).
  4. In Evaluate, click each input bit to flip it between 0 and 1 and watch the output change.
  5. Truth tables and simplification take up to 8 variables; Karnaugh maps are drawn for 1 to 4.

Boolean Algebra Lab

Worked Example

Type AB + A'C + BC (the consensus theorem preset) and open Simplify. The output is 1 for minterms 1, 3, 6 and 7. The minimal sum-of-products is A′C + AB, the minimal product-of-sums is (A + C)(A′ + B), and the literal count drops from 6 to 4. The BC term was redundant: whenever B and C are both 1, either A′C or AB is already 1.

Variation: the default A AND (B OR NOT C) gives the minimal SOP AC′ + AB, which has 4 literals, one more than the original. Its POS, (B + C′)(A), is the same as the original A(B + C′). A minimal SOP is not always the smallest circuit, so compare it with the POS.

The common mistake: forgetting that AND binds tighter than OR. A + BC means A + (BC), which is 1 for minterms 3 to 7 and stays as BC + A. (A + B)C is a different function, 1 only for minterms 3, 5 and 7, and simplifies to BC + AC.

Show Work: How Quine–McCluskey Simplifies

This is the method the Simplify view uses, worked by hand for AB + A'C + BC (variables A, B, C).

1. List the minterms. The truth table is 1 in rows 1 (001), 3 (011), 6 (110) and 7 (111).

2. Combine pairs that differ in one bit. 001 and 011 differ only in B, giving 0-1, which is A′C. 011 and 111 give -11 (BC). 110 and 111 give 11- (AB). No two of these differ in only one position, so the combining stops. These three are the prime implicants.

3. Pick the essential ones. Row 1 is covered only by A′C and row 6 only by AB, so both must be used. Together they already cover rows 1, 3, 6 and 7, so BC is not needed.

4. Result. Minimal SOP = A′C + AB, down from 6 literals to 4. The minimal POS comes from doing the same on the 0 rows (0, 2, 4, 5): 0-0 and 10- are essential and give (A + C)(A′ + B).

When some rows are still uncovered after step 3, the tool keeps adding the prime implicant that covers the most remaining rows. That shortcut is not always optimal: it is exact for every function of up to three variables, but for about 1.2% of four-variable functions it returns one term more than necessary.

Formulas and Rules

Truth table
all 2ⁿ input combinations → output
Quine–McCluskey
prime implicants → essential terms + cover → minimal SOP
Karnaugh map
Gray-code grid; adjacent 1s → product terms
SOP / POS
sum-of-products & product-of-sums forms
Gate diagram
AND · OR · NOT · XOR (+ bubbles for N-variants)
NAND / NOR
functionally complete; NOT X = X NAND X
De Morgan
(A·B)′ = A′ + B′ · (A + B)′ = A′·B′
Precedence
NOT > AND > XOR > OR
Absorption
A + AB = A · A + A′B = A + B
Consensus
AB + A′C + BC = AB + A′C

History

George Boole published his algebra of logic in 1847 and expanded it in An Investigation of the Laws of Thought in 1854; Augustus De Morgan stated his laws in the same period. In his 1937 MIT master's thesis, Claude Shannon showed that this algebra describes relay and switching circuits, which made it the working language of digital design.

Simplification methods followed. Edward Veitch published a chart method in 1952, and Maurice Karnaugh refined it into the Karnaugh map at Bell Labs in 1953. Willard Van Orman Quine described the prime-implicant approach in 1952, and Edward McCluskey turned it into a tabular procedure in 1956, which is why the method is called Quine–McCluskey and why it suits a computer better than a map does.

About This Lab

One expression feeds six views: the truth table, the minimal sum-of-products and product-of-sums, a Karnaugh map for 1 to 4 variables, a gate diagram of the expression as you wrote it, NAND-only and NOR-only forms, and an evaluator where you flip inputs by hand. Truth tables and simplification accept up to 8 variables.

Variable names are single letters and are not case-sensitive. The simplifier always returns a correct equivalent expression; on some four-variable and larger functions it can use one more term than the true minimum, as explained in Show Work. In the NAND and NOR forms, a group such as (A NAND B NAND C) means one three-input gate. Everything runs in your browser.

Frequently Asked Questions

What notation can I use?

Keywords AND OR NOT XOR NAND NOR XNOR, or symbols: &, ·, * or a period for AND (and letters written together, so AB = A·B); + or | for OR; !, ~ or a trailing ' for NOT; ^ for XOR. Precedence is NOT, then AND (and NAND), then XOR (and XNOR), then OR (and NOR). Use brackets when in doubt.

How is the expression simplified?

With the Quine–McCluskey method. It combines rows that differ in one bit until it has every prime implicant, keeps the essential ones, then covers any remaining rows by repeatedly taking the prime implicant that covers the most of them. That gives the true minimum for every function of up to three variables. For about 1.2% of four-variable functions it uses one term more than needed: Σm(1, 2, 4, 5, 6, 8, 9, 10) comes out as five terms where four are enough. The result is always correct, just not always the shortest.

What is a Karnaugh map?

A grid that arranges the truth table so that neighbouring cells differ in one variable (Gray-code order 00, 01, 11, 10). Rectangles of 1s whose size is a power of two correspond to simplified product terms, which is why K-maps are taught for simplifying by hand. The tool draws the map for 1 to 4 variables and shows the matching minimal SOP.

Why convert to NAND-only or NOR-only?

NAND and NOR are each functionally complete: any logic function can be built from just one of them, and NOT X is X NAND X. A 7400 chip holds four 2-input NAND gates, so a design in one gate type can save parts. The tool builds the NAND-NAND form from the minimal SOP and the NOR-NOR form from the minimal POS. A group like (A NAND B NAND C) means one three-input gate.

What does the gate diagram show?

It draws your expression as a logic schematic, inputs on the left and gates (AND, OR, NOT, XOR, with bubbles for the inverting versions) leading to the output Q. It follows the expression as written, so simplify first if you want the smallest circuit.

How do I use the Boolean Algebra Lab?

Just type your numbers. The answer shows up right away — there is no button to press. Change anything and it updates by itself.

Does it cost anything or need an account?

No. The tool is completely free, there is no account to create, and it keeps working offline after the page first loads.

Is anything I type uploaded?

No. The tool works entirely on your device, so the values you enter never leave your browser.

Common Use Cases

Digital Electronics

Minimise combinational logic and convert it to NAND-only or NOR-only form before wiring it from 7400-series chips.

Logic Courses

See the truth table, Karnaugh map and Quine–McCluskey result for the same expression side by side.

Programming

Simplify a long if-condition: write it as letters, simplify, and translate the result back.

Checking a Gate Network

Type the logic a circuit implements and compare its truth table with the behaviour you measured.

Last updated: