MechSimulator

Logic Gates Simulator

Drag & Drop • 22 Digital Components • Truth Tables • Boolean Algebra • Flip-Flops — Simulate • Explore • Practice • Quiz

Mode
📖 User Guide
Presets
Click a component to add it, then drag to position. Click ports to connect.
User Guide — Logic Gates Simulator
1 Overview

Welcome to the Logic Gates Simulator — a free, browser-based digital logic simulator designed for electronics students, computer engineering learners, vocational instructors, and anyone studying digital systems. This tool provides interactive circuit building with 22 digital components, automatic truth table generation, real-time Boolean expression derivation, and comprehensive learning modes — all without installation, signup, or licensing fees.

The simulator features 8 basic logic gates (AND, OR, NOT, NAND, NOR, XOR, XNOR, Buffer), 4 combinational components (MUX, DEMUX, Decoder, Encoder), 4 sequential elements (SR Latch, D/JK/T Flip-Flops), input/output pins, clock source, 7-segment display, and probe. It includes 10 preset circuits and 4 interactive learning modes (Simulate, Explore, Practice, Quiz).

2 Setting Up the Problem
Logic Gates simulator interface preview

Select components from the collapsible palette on the left. Click a component to place it on the canvas, or drag it directly. Click on port circles to create connections (wires) between components. Click the Run button to start the simulation and watch logic signals propagate through your circuit with colour-coded wires (green = HIGH, grey = LOW).

Load a preset circuit (AND/OR/NOT, Half Adder, Full Adder, MUX from Gates, SR Latch, D Flip-Flop, 4-bit Counter, 7-Seg Decoder, Alarm System, or Traffic Light) to instantly study a working configuration. Toggle input pins during simulation to see how outputs change in real time. The truth table and Boolean expression update automatically.

3 Component Library — 22 Digital Components

Input/Output (4): Input Pin (toggleable HIGH/LOW), Output Pin (LED indicator), Clock Source (adjustable frequency square wave), Constant (fixed 0 or 1).

Basic Gates (8): AND (output 1 when all inputs are 1), OR (output 1 when any input is 1), NOT/Inverter (complements input), NAND (inverted AND — universal gate), NOR (inverted OR — universal gate), XOR (output 1 when inputs differ), XNOR (output 1 when inputs match), Buffer (passes signal unchanged, used for fan-out).

Combinational (4): MUX 2:1 (selects one of two inputs), DEMUX 1:2 (routes input to one of two outputs), Decoder 2:4 (activates one of four outputs based on 2-bit address), Encoder 4:2 (encodes four inputs into 2-bit binary).

Sequential (4): SR Latch (Set-Reset memory element), D Flip-Flop (data storage, edge-triggered), JK Flip-Flop (versatile toggle/set/reset), T Flip-Flop (toggles on each clock edge — basis of counters).

Utility (2): 7-Segment Display (shows hexadecimal digit from 4-bit input), Probe (displays signal value at any point in the circuit).

4 Simulation & Truth Tables

Click Run to start the simulation. Wires turn green for logic HIGH (1) and remain grey for logic LOW (0). Toggle input pins by clicking them during simulation to observe how outputs respond. The simulator automatically propagates signals through all connected gates.

The Truth Table panel auto-generates the complete truth table for your circuit, listing all input combinations and their corresponding outputs. The Boolean Expression display shows the simplified algebraic expression derived from your circuit. Use these tools to verify your designs and understand the relationship between circuit topology and Boolean logic.

For sequential circuits, use the Clock Source component to drive flip-flops. Adjust the clock frequency in the properties panel. The I/O panel provides a compact view of all input toggles and output LED indicators.

5 Keyboard Shortcuts

Shortcuts: Space = Run/Stop, Ctrl+Z = Undo, R = Rotate, D = Duplicate, Delete = Delete, Escape = Cancel.

6 Tips & Tricks
  • Use NAND gates only to build any logic function — NAND is a universal gate.
  • Connect a NOT gate by wiring a single input to a NAND gate with both inputs tied together.
  • Build a half adder with one XOR gate (sum) and one AND gate (carry).
  • Add a probe to intermediate wires to debug complex circuits.
  • Use T flip-flops in series to build binary counters — each stage divides the clock frequency by 2.
  • Check the truth table to verify your circuit matches the expected Boolean function before moving on.
  • Right-click any component for quick access to Info, Duplicate, Rotate, and Delete options.

Logic Gates Simulator — Build and Learn Digital Circuits Online

Logic gates simulator showing AND OR NOT XOR NAND and NOR gate symbols with input switches and output LEDs, plus a live truth table updating as the inputs change, with the current combinational logic configuration showing the Boolean expression
Gate palette. Click input switches and the output LED responds; the truth table on the right tracks the current input combination.

Why NAND Is the Universal Gate

Any Boolean function can be built from just NAND gates. AND? Two NANDs. OR? Three NANDs. NOT? One NAND with inputs tied together. This universality is not academic; it has real economic consequences. CMOS NAND gates need 4 transistors to build. Most digital chips therefore implement their internal logic predominantly with NAND-equivalent structures. The 7400-series TTL family is named after the first NAND chip (7400 = quad 2-input NAND). The 74-series legacy still defines the way every electronics undergraduate first learns logic.

De Morgan’s Theorems — The Single Most Useful Simplification

NOT(A AND B) = NOT(A) OR NOT(B). NOT(A OR B) = NOT(A) AND NOT(B). These two identities (De Morgan, 1850) are the most-used rewrites in digital design. They let you push inversions through gate inputs, swap AND-OR forms with NAND-NAND forms, and reduce gate counts in real circuits. Combined with absorption (A + AB = A), De Morgan is the basis of Karnaugh-map minimisation that takes a 16-input function from 100 gates down to 20.

Propagation Delay — The Speed Limit You Cannot Wish Away

Every real gate has a propagation delay — the time between an input transition and the output transition. For 74HC CMOS at 5 V, propagation delay is typically 10 ns; for modern 74LVC at 1.8 V, about 3 ns; for state-of-the-art digital logic in a 7 nm process, well under 1 ps per stage. Cascading 100 gates in series produces 100× delay. Long combinational chains limit clock frequency — the path from one flip-flop to the next must settle in less than one clock period. This is why modern processors have so many pipeline stages: each is short enough to complete in one clock cycle.

References

A logic gate is the fundamental building block of digital electronics. Logic gates take binary inputs (0 or 1) and produce a binary output based on a defined Boolean function. This free logic gates simulator lets you build digital circuits with 22 components, generate truth tables automatically, and derive Boolean expressions — all in your browser without installation.

What Are Logic Gates?

Logic gates are electronic circuits that implement Boolean functions. The AND gate outputs 1 only when all inputs are 1. The OR gate outputs 1 when at least one input is 1. The NOT gate (inverter) flips the input: 0 becomes 1 and 1 becomes 0. These three form the basis of all digital logic. The NAND gate (NOT-AND) and NOR gate (NOT-OR) are called universal gates because any Boolean function can be constructed using only NAND gates or only NOR gates. The XOR gate (exclusive OR) outputs 1 when inputs differ, making it essential for arithmetic circuits like adders and parity checkers.

Boolean Algebra and Logic Simplification

Boolean algebra provides the mathematical framework for analysing and simplifying digital circuits. Key laws include the identity law (A·1=A), complement law (A·A′=0), and De Morgan’s theorems: (A·B)′=A′+B′ and (A+B)′=A′·B′. These theorems allow designers to convert between AND/OR/NOT implementations and NAND/NOR-only circuits. This simulator automatically generates the Boolean expression for any circuit you build, helping you verify and simplify your designs.

Combinational vs Sequential Logic

Combinational logic circuits produce outputs that depend solely on the current inputs. Examples include adders, multiplexers (MUX), demultiplexers (DEMUX), decoders, and encoders. A half adder uses one XOR gate for the sum and one AND gate for the carry. A full adder adds three bits (two inputs plus carry-in) and is the building block of binary arithmetic units.

Sequential logic circuits include memory elements whose outputs depend on both current inputs and previous states. The SR latch is the simplest memory element, storing one bit using cross-coupled NAND or NOR gates. The D flip-flop captures data on the clock edge and is the basis of registers. The JK flip-flop eliminates the invalid state of the SR latch and can toggle. The T flip-flop toggles its output on every clock edge, making it ideal for building binary counters.

Common Logic Gate Truth Tables

GateExpressionOutput = 1 When
ANDY = A · BAll inputs are 1
ORY = A + BAny input is 1
NOTY = A′Input is 0
NANDY = (A · B)′Any input is 0
NORY = (A + B)′All inputs are 0
XORY = A ⊕ BInputs differ
XNORY = (A ⊕ B)′Inputs are equal

Applications of Digital Logic

Logic gates are used in virtually every electronic device. Arithmetic logic units (ALUs) in CPUs use adders and comparators built from basic gates. Memory circuits use flip-flops arranged into registers and RAM cells. Counters and timers use cascaded T flip-flops. Decoders drive 7-segment displays for numeric output. Multiplexers route data in communication systems. Industrial control systems use combinational logic for safety interlocks — for example, requiring two-hand operation (AND logic) on press machines. Understanding digital logic is fundamental to computer engineering, embedded systems, FPGA design, and PLC programming.

Who Uses This Logic Gates Simulator?

This digital logic simulator is designed for electronics and computer engineering students, vocational education (TVET) learners studying digital systems, instructors demonstrating logic concepts in the classroom, and hobbyists exploring circuit design. The four learning modes (Simulate, Explore, Practice, Quiz) provide a complete educational experience from Boolean algebra theory to hands-on circuit building. Try our related PLC Ladder Logic Simulator to see how digital logic concepts apply to industrial automation.

Explore Related Simulators

If you found this logic gates simulator helpful, explore our PLC Ladder Logic Simulator, Electro-Pneumatic Circuit Simulator, Ohm's Law Simulator, and DC Motor Simulator for more hands-on practice.