ceo@instrumentationblog.in
Digital Logic Tools · Free Tool

Karnaugh Map Solver (K Map)

Click the cells of a 2, 3 or 4 variable Karnaugh map, or type minterms and don't cares, and get the minimal SOP and POS expressions with each group highlighted.

2 to 4 variablesDon't care (X) cellsMinimal SOP and POSGroups shown on the map

Tip: click a cell to cycle 0, 1 and X. The small number in each cell is its minterm index.

Minimal SOP (sum of products)0
Minimal POS (product of sums)0
How this result was found
    Advertisement

    How to Solve a Karnaugh Map

    A Karnaugh map is a truth table drawn as a grid. The rows and columns follow Gray code order (00, 01, 11, 10), so any two cells side by side differ in only one variable. That is why neighbouring 1s can be grouped and the changing variable drops out.

    Group size: 1, 2, 4, 8 or 16 cells (a power of 2)
    A group of 2k cells removes k variables
    Edges wrap around: the left column touches the right column, the top row touches the bottom row

    Grouping rules

    1. Group only 1s (and X cells when they help). Never include a 0.
    2. Make every group as large as possible: 8 beats 4, 4 beats 2.
    3. Groups must be rectangles whose size is a power of 2. Wrap around edges and corners is allowed.
    4. Use the fewest groups that cover every 1. Overlapping is fine.
    5. Don't care cells (X) can be used as 1 or left out, whichever gives a simpler answer.

    Worked example

    F(A, B, C, D) = Σm(0, 1, 2, 5, 6, 7, 8, 9, 10, 14). Cells 0, 1, 8 and 9 (the top and bottom rows wrap around) form the group B'C'. The whole CD = 10 column (2, 6, 14, 10) forms CD'. Cells 5 and 7 pair up as A'BD. Result: F = B'C' + CD' + A'BD, three terms instead of ten.

    For the POS form the solver groups the 0 cells the same way and writes each group as a sum term, so you can check both answers and pick the cheaper circuit.

    Key insight: the solver uses the Quine McCluskey method behind the map, so the answer is guaranteed minimal for 2, 3 and 4 variables, including the corner and edge groups that are easy to miss by hand.
    Advertisement

    Frequently Asked Questions

    What is a Karnaugh map used for?

    A Karnaugh map (K map) simplifies a Boolean function to the fewest terms and literals, which means fewer logic gates or simpler PLC ladder rungs.

    Why does the K map use 00, 01, 11, 10 order?

    That is Gray code. Adjacent cells differ in one variable only, so grouping them removes that variable from the term.

    What does a don't care (X) mean?

    An input combination that never happens or whose output does not matter. The solver uses an X as 1 only when it makes a group bigger.

    How do I get the POS form from a K map?

    Group the 0 cells instead of the 1 cells, then write each group as a sum term with the variables complemented. This tool shows SOP and POS together.

    Can a K map have more than 4 variables?

    Yes, 5 and 6 variable maps use two or four 4 variable maps side by side, but they get hard to read. For more inputs use the Boolean algebra calculator.

    You May Also Like

    Learn more on the blog

    Karnaugh map explained with grouping rules

    A practical guide on instrumentationblog.in that explains the theory behind this tool with solved examples.

    Read Full Article

    More Digital Logic Tools

    More Instrumentation Tools

    2 toolsInstrument Tag DecoderDecode ISA 5.1 instrument tags and look up every identification letter.4 toolsIP, NEMA and Ex Rating DecoderDecode IP codes, NEMA enclosure types, ATEX and IECEx Ex markings and hazardous area zones.4 toolsWire and Cable Color CodesWire colour codes for power, control panels, thermocouples and RTDs by standard.9 toolsPID Tuning ToolsPID tuning calculators, PID form converter and an online PID loop simulator.4 toolsP&ID SymbolsSearchable P&ID symbols for instruments, lines, valves and flow elements.3 toolsPipe and Flange ChartsPipe schedules, ASME B16.5 flange dimensions and pressure ratings.4 toolsThread Size ChartsNPT, BSP and metric thread sizes and a thread identifier for instrument fittings.17 toolsTroubleshooting GuidesInteractive fault finders for transmitters, flowmeters, valves and loops.18 toolsPractice TestsInstrumentation quizzes with instant scores and explained answers.3 toolsDigital Logic ToolsK map solver, Boolean algebra simplifier and truth table generator for digital electronics and PLC logic.3 toolsElectrical Selection ToolsConduit fill and wire gauge calculators to the NEC, plus an ANSI device numbers decoder for protection relays.2 toolsMechanical ChartsGalvanic corrosion chart with a metal pair checker and a bolt torque calculator for SAE and metric bolts.2 toolsProcess Engineering ToolsPsychrometric calculator with a live chart and a flow rate calculator for pipes.CalculatorsCalculatorsFree engineering calculators for flow, level, pressure, temperature, valves and more.ConvertersUnit Converters76 converters, 700+ units.