Boolean Algebra Simplifier & Karnaugh Map Calculator
Find the fewest groups and literals needed to represent a Boolean function in sum-of-products or product-of-sums form. Enter minterm indexes, mark don’t-care outputs, or edit the truth table directly. Follow each group on the Gray-code map, including groups that wrap from one edge to the other, and compare tied minimal expressions.
Explore minimal Boolean forms
Edit a truth table, inspect groups on a Karnaugh map and compare the exact minimal sum-of-products and product-of-sums expressions.
Truth values
List decimal indexes 0–15 separated by spaces or commas. Unlisted outputs start at 0.
Truth table and cover outputs
| Index | Bits | Output | SOP | POS |
|---|---|---|---|---|
| m0 | 0000 | 1 | 1 | |
| m1 | 0001 | 0 | 0 | |
| m2 | 0010 | 1 | 1 | |
| m3 | 0011 | 0 | 0 | |
| m4 | 0100 | 0 | 0 | |
| m5 | 0101 | 1 | 1 | |
| m6 | 0110 | 0 | 0 | |
| m7 | 0111 | 1 | 1 | |
| m8 | 1000 | 1 | 1 | |
| m9 | 1001 | 0 | 0 | |
| m10 | 1010 | 1 | 1 | |
| m11 | 1011 | 0 | 0 | |
| m12 | 1100 | 0 | 0 | |
| m13 | 1101 | 1 | 1 | |
| m14 | 1110 | 0 | 0 | |
| m15 | 1111 | 1 | 1 |
Minimum SOP 2 groups. Minimum POS 2 groups.
Sum of products (SOP)
B′ · D′ + B · D
2 groups · 4 literals
Product of sums (POS)
(B + D′) · (B′ + D)
2 groups · 4 literals
Karnaugh map
Inspect the selected cover. Each group fixes the bits that stay the same across its cells.
Rows AB · Columns CD
Gray-code order
Select a cell to cycle 0 → 1 → X. Dashed outlines continue across opposing edges.
A don’t-care cell can resolve to 0 or 1. The selected SOP and POS may give it different values. Compare their outputs in the truth table.
View CSV text
How to use this calculator
- Choose 2, 3, or 4 variables. A is the most significant bit of each decimal input index.
- Enter indexes with output 1 in Minterms. Enter indexes whose output may be either 0 or 1 in Don’t-cares. Separate indexes by commas or spaces.
- Select a Karnaugh map cell or a truth table output to cycle it through 0, 1 and X. The other view and both expression forms update together.
- Choose SOP or POS under Groups to show. Pick a tied cover when available. Select a group to isolate its members and see which edges connect.
- Open Truth table and cover outputs to compare both forms at every input. Download CSV to keep the truth values, displayed covers, groups and evaluations.
The Formula
The mathematical logic powering this calculation is:
For SOP, make groups of required 1 cells and optionally include don’t-cares. Each group gives a product of its fixed input variables. A variable fixed at 0 takes a complement, while a variable fixed at 1 stays uncomplemented. OR these products together. For POS, group required 0 cells and optionally include don’t-cares. Each group gives a sum that equals zero at its fixed bits, so a fixed 1 takes a complement and a fixed 0 stays uncomplemented. AND these sums together. The exact cover minimizes group count first, then total literal count. The resulting cost applies to these two-level forms.Worked Example
If you input:
- Variables: 4
- Minterms (output 1): 0, 2, 5, 7, 8, 10, 13
- Don’t-cares (output X): 15
Result:
The minimal sum of products is B′ · D′ + B · D. Its first group connects the four corners m0, m2, m8 and m10 across both map edges. Its second group uses the don’t-care m15. The minimal product of sums is (B + D′) · (B′ + D). Both forms have two groups and four literals, and both assign 1 to m15 in this example.
Frequently Asked Questions
What is the difference between a minterm and a maxterm?
A minterm is a product true at one input row. List the decimal indexes of rows where the function should output 1. A maxterm is a sum false at one input row. The zero rows from the same truth table supply the starting maxterms for product of sums.
Why do the labels follow 00, 01, 11, 10?
This Gray-code order changes exactly one bit between neighbors, including from the last column or row back to the first. A group may wrap around an edge. In a four-variable map the four corners can form one group when they all have the required value or are don’t-cares.
How does the calculator use a don’t-care input?
The solver can include an X cell if it helps form a larger legal group. Each chosen expression assigns a definite 0 or 1 to that row. The truth table displays both assignments because different minimal expressions may choose different values while agreeing on every 0 and 1 that you specified.
Why can more than one expression be minimal?
Different groups can cover the same required cells at the same cost. The calculator chooses the fewest groups, then the fewest total literals at that group count. You can inspect up to six distinct covers per form that tie at that cost.
What does a constant expression mean?
A constant has the same output for every row. If there are no required 1 cells, SOP can use constant 0. If there are no required 0 cells, POS can use constant 1. When every cell is a don’t-care, both constants are valid choices.
Does minimal SOP or POS always use the fewest physical gates?
The solver optimizes two-level groups and literals. A circuit built with factored expressions, XOR gates, shared terms or technology-specific gates can use a different number of components. Circuit timing and hazard-free design are separate objectives.
Similar Calculators
Permutation & Combination Calculator
Calculate nPr and nCr values for arranging or selecting items with or without order.
Binomial Probability Calculator
Find exact, cumulative, or upper-tail binomial probabilities for repeated yes/no events.
Linear Programming Calculator
Maximize or minimize a linear objective with variable bounds and constraints. Inspect simplex steps, exact certificates and equally good plans.
