Uni-Sine
Computer ScienceData and logic

Boolean algebra calculator

A Boolean algebra calculator simplifies a logic expression to the fewest terms that give the same truth table. Type an expression such as A'B + AB + AB' into our Boolean Algebra Simplifier and it simplifies it one law at a time, naming each one, then checks the answer with a Karnaugh map. That one comes out as A + B.

It handles up to 8 variables for the minimal form, and draws Karnaugh maps for up to 4. It opens on A'B + AB + AB'.

Try it

Boolean Algebra Simplifier

Simplify expressions with Boolean laws and Karnaugh maps

Go to its page

How to use the Boolean algebra calculator

  1. Type the expression in the Expression box. Use letters for variables, a prime (') or NOT for not, juxtaposition, · or AND for and, and + or OR for or. Brackets work.
  2. Choose the notation for the answer: AND OR, ∧ ∨ ¬ or · + ′.
  3. Choose Group the 1s for a sum of products, or Group the 0s for a product of sums.
  4. Read the simplified expression, the number of letters before and after, and the minimal form.
  5. Follow the working, which names each law it uses, and look at the Karnaugh map with its groups drawn.

Tap a cell on the Karnaugh map to mark it as a don't care, and the minimal form uses it if that makes the answer smaller. The examples under the box include De Morgan, consensus and a product of sums. For practice, Practice and help sets simplification questions with worked solutions.

The Boolean algebra laws it uses

LawAND formOR form
IdentityA · 1 = AA + 0 = A
NullA · 0 = 0A + 1 = 1
ComplementA · A′ = 0A + A′ = 1
IdempotentA · A = AA + A = A
AbsorptionA(A + B) = AA + AB = A
De Morgan's(AB)′ = A′ + B′(A + B)′ = A′B′
DistributiveA(B + C) = AB + ACA + BC = (A + B)(A + C)
RedundancyA(A′ + B) = ABA + A′B = A + B
ConsensusAB + A′C + BC = AB + A′C(A + B)(A′ + C)(B + C) = (A + B)(A′ + C)

Each law has a dual: swap AND with OR and 0 with 1, and it stays true. The calculator names the law in every step, such as "Absorption law" or "Consensus theorem".

Worked examples you can check in the calculator

Example 1: combining terms, then redundancy

Simplify A′B + AB + AB′. The first two terms share B, so A′B + AB = B(A′ + A) = B. That leaves B + AB′, and by the redundancy law B + B′A = B + A:

A'B + AB + AB' = B + AB' = A + B

The calculator shows the same two steps, "Combining terms" and "Redundancy law", and reports 6 letters cut to 2.

Example 2: absorption

Simplify A + AB. Whenever A is true the whole thing is true, and when A is false both terms are false, so A + AB = A. The calculator names this the absorption law.

Example 3: De Morgan's law

Simplify (A + B)′A, typed as NOT (A OR B) AND A. De Morgan turns (A + B)′ into A′B′, so the expression is A′B′A. It contains both A and A′, so by the complement law it is always 0:

(A + B)'A = A'B'A = 0

Example 4: the consensus theorem

Simplify AB + A′C + BC. The term BC is the consensus of AB and A′C: when B and C are both 1, either A is 1 and AB covers it, or A is 0 and A′C does. So BC can go:

AB + A'C + BC = AB + A'C

This one is easy to miss by hand. The calculator names it the consensus theorem.

Karnaugh maps

A Karnaugh map lays out the truth table so that neighbouring cells differ in one variable. Grouping 1s in blocks of 1, 2, 4 or 8, including groups that wrap round the edges, gives the minimal sum of products. The calculator draws the map with its groups for up to 4 variables.

Example 5: five terms down to two

Simplify A′B′C + A′BC + AB′C + ABC + ABC′. On the map, the four cells with C = 1 form a group of four, giving C, and the two cells with A = 1 and B = 1 form a pair, giving AB:

A'B'C + A'BC + AB'C + ABC + ABC' = AB + C

The calculator cuts 15 letters to 3.

Checking with a truth table

Two Boolean expressions are equal when they give the same output for every row of the truth table. For Example 1, A′B + AB + AB′ and A + B are both 0 only when A = 0 and B = 0, and 1 in the other three rows. The Truth Table Generator builds the full table for any expression. Try completing one in the course, then press Mark:

Fill in the blank output cells of a gate's truth table.

Press Mark to have your answer marked in the Circuits course.

Common mistakes

  • Getting De Morgan half right. Break the bar and change the sign: (AB)′ is A′ + B′, not A′B′.
  • Treating + like ordinary addition. In Boolean algebra 1 + 1 = 1, and A + A = A.
  • Missing absorption. A + AB is just A. Look for a term that contains another whole term.
  • Grouping wrongly on a Karnaugh map. Groups must be 1, 2, 4 or 8 cells, rectangular, and can wrap round the edges.
  • Forgetting operator order. NOT comes first, then AND, then OR, unless brackets say otherwise.

Practise logic in a short timed paper

Boolean algebra and logic come up in AP Computer Science Principles and College Discrete Math practice, and in GCSE Computer Science in the UK. Each daily paper is a short timed paper of 8 questions worth 25 to 35 marks, and the papers mix topics. To see an expression as gates, use the Logic Gate Simulator.

Common questions

What is Boolean algebra?
Algebra for values that are only true (1) or false (0), with the operations AND, OR and NOT. It is the maths behind logic gates and digital circuits.
How do you simplify a Boolean expression?
Apply the laws, such as absorption, De Morgan's and combining terms, until no more letters can be removed. A Karnaugh map is a visual way to find the same minimal answer.
What is De Morgan's law?
NOT (A AND B) = NOT A OR NOT B, and NOT (A OR B) = NOT A AND NOT B. In symbols, (AB)′ = A′ + B′ and (A + B)′ = A′B′.
What is a sum of products?
An OR of AND terms, such as AB + A′C. A product of sums is an AND of OR terms, such as (A + B)(A′ + C).
How many variables can the calculator handle?
Up to 8 for the minimal form, found by the Quine-McCluskey method, and up to 4 on a drawn Karnaugh map.
What is a don't care?
An input combination that never happens, or whose output does not matter. It can be counted as 0 or 1, whichever makes the groups bigger.

Revision cards

Say the answer first, then flip the card to check it.

Where to go next

  • Solve it

    Boolean Algebra Simplifier

    Simplify expressions with Boolean laws and Karnaugh maps

    Open the tool
  • Learn it

    Circuits

    Resistors, capacitors and logic gates: build and understand real circuits

    Start the course
  • Test it

    AP Computer Science Principles

    A new exam-style paper every day, with instant marking and a mark scheme

    Start today's paper
Read next
Computer Science · Data and logicLogic gate simulator: build circuits, see the truth tableBuild logic circuits from AND, OR, NOT, NAND, NOR and XOR gates, flip switches and watch the signals, with a live truth table and an expression per lamp.