Toolvito

Calculates on this device. File exports run online.

Logic Gate Simulator

Type a Boolean expression such as AB + A'C, or the output column of a truth table. You get the truth table, the gates drawn as a circuit, the shortest AND-OR, OR-AND, NAND-only or NOR-only circuit, and a simulation that shows the value on every wire for the inputs you set.

Enter your values

The truth table, the minimal forms and the gates of an expression, drawn as a circuit.

Your values

Use AND, OR, NOT, XOR (or · + ' ⊕). Letters side by side are joined by AND: AB means A AND B.

More options

Such as A B C. It sets the order of the rows. Leave it empty for alphabetical order.

Your values are worked out in this browser. They are not sent to a server.

Your result will show here

Fill in the values, then choose Calculate.

Minimal forms of up to 16 variables

Minimal forms of up to 16 variables

Uses the expression or truth table of the result above. The server reads the function again, finds every prime implicant, chooses the cheapest cover exactly with an integer program, checks the answer on the whole truth table and compares it with SymPy. It works for up to 16 variables; you also get the truth table as CSV and the result as JSON.

The calculator above works on your device. When you run a task in this section, Toolvito receives the values and result you submit to make the file or run the check. Download the result within one hour after the job finishes. Choose Delete files now to request earlier removal. The hourly cleanup normally removes files within one to two hours after completion.

How to use the simulator

  1. Choose Circuit of an expression and type the expression, or Circuit from a truth table and type the output column.
  2. Choose what to draw: the circuit as typed, or the minimal AND-OR, OR-AND, NAND-only or NOR-only circuit.
  3. To simulate, choose Simulate a circuit for input values and type the inputs, such as A=1, B=0, C=1. Every wire shows its value.
  4. For functions of 9 to 16 variables, use the box under the result for the minimal forms.

Writing expressions

  • NOT: A' or NOT A or ¬A. AND: AB, A·B, A AND B. OR: A + B or A OR B. XOR: A ⊕ B or A XOR B. NAND: A ↑ B. NOR: A ↓ B.
  • Order: NOT first, then AND, then XOR, then OR. Brackets change the order: (A + B)C.
  • Names are one letter with digits after it if wanted (A, x1). AB means A AND B.

How the minimal circuit is found

  • Quine-McCluskey: rows where the output is 1 are joined while they differ in one input; the terms that cannot grow are the prime implicants.
  • Petrick's method chooses the fewest prime implicants (and then the fewest literals) that cover every 1. The product of sums comes from the 0s by De Morgan's laws.
  • NAND only / NOR only: an AND-OR circuit becomes NAND-NAND, an OR-AND circuit NOR-NOR, with the same number of gates.

Worked example

AB + A'C + BC' is 1 in rows 1, 2, 3, 6 and 7 (A, B, C in that order). The minimal sum of products is A'C + B: one AND gate, one OR gate and one inverter instead of three AND gates, one OR gate and two inverters. As NAND gates only it needs four NAND gates.

Limits you should know

  • Circuits are built from expressions and truth tables; there is no drag-and-drop editor for placing gates and wires by hand.
  • Combinational logic only: flip-flops, latches, clocks, counters and gate delays are not simulated. Transistor-level circuits (CMOS, TTL, LTspice) are not covered.
  • The page works out minimal forms for up to 8 variables and truth tables for up to 16.

Related tools