Premium apps Part of Ohmforge

Ohmforge Truth Table & Logic Minimiser

Boolean expression or minterms → truth table, minimal SOP/POS, Karnaugh map and a gate circuit.

Variables: a letter with an optional number (A, b, x1); AB means A·B. NOT: ' after or ! ~ before; AND: · & * or nothing; OR: + |; XOR: ^. Words AND, OR, NOT, XOR, NAND, NOR, XNOR work too.

Comma-separated, first = most significant bit, e.g. A, B, C, D. Expression: empty = alphabetical. Minterm list: empty = A, B, C, D.

More options

For "Minterm list": numbers and ranges, e.g. 0, 2, 5-7.

Rows whose output does not matter; the minimiser may use them.

Try an example: A'B'C + A'BC + AB'C + ABC' · Minterms 0 2 5 7 8 10 13 15 with don't care 1 · Majority of three as POS

More about this tool

How it works

Enter a Boolean expression (A·B + A'·C, !(A & B) | C, A xor B …) or a list of minterms with don't cares. You get the truth table, the canonical forms, the minimal sum of products and product of sums (Quine–McCluskey with an exact minimum cover), the Karnaugh map for up to six variables, gate counts and an Ohmforge circuit of 2-input gates that is simulated for every row.

  • The expression is parsed with the precedence NOT > AND > XOR > OR (NAND/NOR/XNOR at the level of their base operator) and evaluated for every input row; the first variable is the most significant bit of the row number.
  • Quine–McCluskey: minterms and don't cares are merged pairwise into cubes until no merge is possible; the unmerged cubes are the prime implicants. A minimum cover of the 1 rows is then chosen exactly: essential primes first, then branch and bound on the remaining rows (fewest terms, then fewest literals). The product of sums is the minimum cover of the 0 rows, complemented with De Morgan.
  • Karnaugh maps use Gray-code row and column order (00, 01, 11, 10); five and six variables are shown as two or four 4 × 4 maps selected by the first variables.
  • Gate counts: one NOT per inverted variable, one AND per product with two or more literals and one OR (dual for POS); "2-input gates" counts a k-input gate as k − 1 two-input gates.
  • The circuit uses Ohmforge's behavioural 2-input gates (5 V, threshold 2.5 V), input switches with 10 kΩ pull-downs and a logic probe; for up to 40 gates the DC operating point is solved for every defined row and compared with the truth table.

Two-level minimisation counts terms and literals; it ignores propagation delay, hazards, fan-out and the cost of real gate packages. Multi-level or XOR-based circuits can be smaller (parity functions are the classic example).

Sources

Part of Ohmforge

  • Ohmforge Virtual electronics workbench

    Draw a circuit, switch it on, and measure it with real-feeling bench instruments.

    Open Ohmforge

Related tools

Build truth tables and minimise logic with Karnaugh maps

Turn a Boolean expression or a minterm list into a truth table, minimal SOP and POS forms, a Karnaugh map and a gate circuit that Ohmforge simulates.

What it is for

Digital design starts with a function: when should this output be 1? From there you want a truth table to check it, the smallest two-level expression to build it, and a gate count to see what it costs. This tool does all three for up to six variables, and it hands you a circuit of Ohmforge's 2-input gates that has been simulated row by row.

Enter either a Boolean expression or a Minterm list. Expressions accept ' or ! for NOT, ·, & or nothing for AND, + or | for OR, ^ for XOR, and the words AND, OR, NOT, XOR, NAND, NOR, XNOR. Variables are single letters with an optional number, so AB means A·B and x1x2 means x1·x2. Rows that never occur can be listed as Don't cares.

Minimal here means fewest product terms, then fewest literals, in two levels. Multi-level or XOR-based circuits can be smaller.

Worked example

A classic textbook case: a detector that outputs 1 when a BCD digit (0–9) is a prime number. Codes 10–15 never occur. Settings: Minterm list, variables A, B, C, D, minterms 2, 3, 5, 7, don't cares 10-15.

The result: Minimal SOP = B·D + B'·C, Minimal POS = (B' + D)·(B + C). The Karnaugh map shows why: the don't cares fill row AB = 11 and two cells of row 10, so both groups of four can grow. Quine–McCluskey finds five prime implicants (A·B, A·C, B'·C, B·D, C·D); only B'·C and B·D are essential, and they already cover every 1.

The gate count for the SOP is 1 NOT, 2 AND and 1 OR, 4 two-input gates in total. The note at the bottom confirms that the 4-gate AND–OR circuit was simulated for all 10 defined rows and matches the truth table. Download the circuit and open it in Ohmforge to flip the input switches yourself.

How to read the result

  • Minimal forms: SOP and POS, plus counts of ones, zeros and don't cares.
  • Truth table: row number, inputs (first variable = most significant bit) and the output, with X for don't care.
  • Karnaugh map: Gray-coded rows and columns (00, 01, 11, 10). Five and six variables are split into two or four 4 × 4 maps, titled by the first variables.
  • Prime implicants: every prime, whether it is essential, and whether the minimal SOP uses it.
  • Gate count for both forms and Canonical forms, including versions for code ((B & D) | (!B & C)).

Tips and common mistakes

  • Without commas, AB is A AND B. Multi-letter names such as EN are read as E·N, so use single letters or letters with numbers.
  • NOT binds tightest, then AND, XOR and OR: A + B·C is A + (B·C).
  • Set the Variables in order field when the row numbering matters, for example when your minterm list comes from a datasheet with D as the most significant bit.
  • Don't cares are free: list every impossible input combination, it often removes whole terms.
  • Parity functions (A ^ B ^ C …) have no two-level shortcut; the SOP grows to 2ⁿ⁻¹ terms. Build those with XOR gates instead.

FAQ

Is the result really minimal?

Yes for two-level SOP/POS: after the essential primes, a branch-and-bound search picks the cheapest cover. The test suite compares it with a brute-force optimum for all 65 536 four-variable functions.

Why is the circuit not simulated for my function?

Simulation runs for circuits with up to 40 gates so the tool stays fast. Larger circuits are still built; open the project in Ohmforge to simulate them.

How are inputs driven in the circuit?

Each input is a switch to 5 V with a 10 kΩ pull-down: closed means 1. A logic probe shows the output.

Can I use more than six variables?

Not in this tool; Karnaugh maps stop being readable and the truth table gets very long beyond six inputs.

Guide last updated:

For scripts and AI agents

  • JSON API: POST https://ohmforgetruthtable.usefulweb.app/api/v1/calculate (same calculation as this page)
  • Interface description: OpenAPI 3.1 · AI guide: llms.txt
  • MCP server (Streamable HTTP): https://ohmforgetruthtable.usefulweb.app/mcp · tool name ohmforge_truth_table
Example request
curl -s -X POST https://ohmforgetruthtable.usefulweb.app/api/v1/calculate \
  -H 'content-type: application/json' \
  -d '{"mode":"expression","expression":"A'B'C + A'BC + AB'C + ABC'"}'
Feedback · ideas & bug reports welcome