Karnaugh maps and Boolean simplification
Define a logic function by its truth table, its minterms (Σm) or an expression, and get the Karnaugh map with the groups drawn, the minimal sum of products (SOP) and product of sums (POS), the NAND-only and NOR-only forms and the Quine–McCluskey method step by step.
What you can do
- 2- to 5-variable maps with don't-care conditions.
- Minimal SOP and POS with their cost.
- Quine–McCluskey and Petrick's method.
- Automatic circuit construction.
Frequently asked questions
How do you simplify with a Karnaugh map?
Group adjacent ones into blocks of 1, 2, 4, 8… as large as possible; each group drops the variables that change inside it.
Guide: how to simplify with Karnaugh maps
A logic function can be written directly from its truth table, but that form usually has many terms and therefore many gates. The Karnaugh map is a graphical method to find the simplest expression, the one that gives the cheapest circuit. This guide explains how the map is built and how cells are grouped, and works two examples.
Minterms and canonical form
Each row of the truth table is a minterm, numbered by its binary value: with variables A, B, C, the row A = 1, B = 0, C = 1 is m5. A function can be given as the list of minterms where it equals 1, for example F = Σm(0, 2, 4, 5, 6). The canonical form adds a product of all the variables for each minterm. It is correct, but almost never minimal. In this guide, A′ means "not A"; the tool draws it with a bar on top.
How the map is built
The map places the minterms in a grid whose rows and columns follow the Gray code (00, 01, 11, 10): two neighboring cells differ in a single variable, also from one edge to the opposite one, as if the map were wrapped around. Two neighboring cells with 1 can be merged into one term without the variable that changes, because X·Y + X·Y′ = X.
Grouping rules
- Groups are rectangles of 1, 2, 4, 8… cells (powers of 2).
- Make groups as large as possible: the larger the group, the fewer variables in the term.
- Use the fewest groups that cover all the 1s; a 1 can belong to several groups.
- "Don't care" cells (X) can be included if they make a group larger, but they do not need to be covered.
- For the product-of-sums form (POS), group the 0s instead of the 1s.
Example 1: three variables
F(A, B, C) = Σm(0, 2, 4, 5, 6).
- m0, m2, m4 and m6 have C = 0. They form a group of 4 cells (the two edge columns, which are neighbors), giving the term C′.
- m5 (A = 1, B = 0, C = 1) remains. It is grouped with m4 (A = 1, B = 0, C = 0): C changes and is eliminated, leaving AB′.
- Result: F = C′ + AB′, versus five three-variable terms in the canonical form.
Grouping the zeros (m1, m3, m7) gives the POS form: F = (B′ + C′)(A + C′).
Example 2: four variables
F(A, B, C, D) = Σm(0, 1, 2, 5, 8, 9, 10).
- m0, m1, m8 and m9 (B = 0, C = 0) form a group of 4: B′C′.
- m0, m2, m8 and m10 (B = 0, D = 0), the four corners of the map, which are neighbors across the edges: B′D′.
- m5 (0101) remains and is grouped with m1 (0001): B changes, leaving A′C′D.
- Result: F = B′C′ + B′D′ + A′C′D.
Grouping the zeros: F = (C′ + D′)(B′ + D)(A′ + B′). The tool gives exactly these expressions for both examples.
How to use the tool
- Define the function with the truth table (click an output to cycle through 0, 1 and X), with the list of minterms or with an expression. Choose how many variables and outputs there are and their names.
- On the map, choose to group ones (SOP) or zeros (POS). Each group is explained: which cells it joins, which variable changes and is eliminated and which remain.
- Read the minimal SOP and POS, the NAND-only and NOR-only forms, the canonical forms and the cost in gates and inputs.
- "Build the circuit" assembles the minimal circuit in the simulator so you can test it with switches and LEDs.
Common mistakes
- Ordering rows and columns in binary (00, 01, 10, 11) instead of Gray code: neighboring cells no longer differ in a single variable.
- Missing that the edges are neighbors, including the four corners.
- Making groups of 3 or 6 cells. Only powers of 2 are allowed.
- Adding groups that cover no new 1. They are redundant.
Further reading
M. M. Mano and M. D. Ciletti, Digital Design (Pearson); J. F. Wakerly, Digital Design: Principles and Practices (Pearson). The method is due to M. Karnaugh (1953). Simuveliq is not affiliated with these authors or publishers.
More tools
Versión en español
About Simuveliq · Privacy policy · Contact