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
Check these values
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.
Your result
How it was worked out
How to use the simulator
- Choose Circuit of an expression and type the expression, or Circuit from a truth table and type the output column.
- Choose what to draw: the circuit as typed, or the minimal AND-OR, OR-AND, NAND-only or NOR-only circuit.
- 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.
- 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.