HubTools

Logic Simulator

Build and simulate digital logic circuits in the browser. Drop in gates, wire them together, and watch signals propagate.

What is a Logic Simulator?

A logic simulator is software that models the behavior of digital circuits — the gates, flip-flops, and buses that make up CPUs, GPUs, and every other digital chip. You drop primitive components onto a canvas, wire them together, and watch the simulator propagate 0s and 1s through the network in real time. Logic simulators are the central pedagogical tool in undergraduate computer architecture courses, where students typically build half-adders, full-adders, ALUs, register files, and eventually toy CPUs from a tiny set of primitives. This simulator is a TypeScript port of Sebastian Lague's Digital-Logic-Sim, restricted to NAND, Clock, Pulse, and Tri-State Buffer — because NAND is functionally complete, you can derive every other gate yourself. Need to test Boolean expressions analytically? Try the Scientific Calculator. Building a study deck for a CS course? Use the Flashcard Generator.
Loading editor…

How to use this tool

  1. 1
    Drop primitives onto the canvas
    Drag NAND gates, Clocks, Pulses, Tri-State Buffers, splitters, and mergers from the left panel onto the work area.
  2. 2
    Wire them together
    Click an output port and drag to an input port. Wires automatically infer bit width from the connected ports.
  3. 3
    Add input switches and output probes
    Use input nodes to drive 0/1 manually, or wire a Clock to generate a square wave. Output probes display the current logic level.
  4. 4
    Save your circuit
    Hit Save to persist the circuit to localStorage. Export the JSON to share or version-control your designs.

Frequently asked questions

Why does the simulator only have NAND gates?
NAND is functionally complete — every other gate (AND, OR, NOT, XOR, NAND-XNOR) can be built from NAND alone, and so can every flip-flop, multiplexer, and ALU. Restricting to NAND mirrors how silicon foundries actually build chips: it's the cheapest single-gate cell in CMOS, so real hardware is laid out as a sea of NANDs. Building higher-level gates from NAND is the central exercise in introductory digital design courses.