# Logic Circuit Simulator - Gates, Flip-Flops, Truth Tables

> Build digital logic circuits in your browser: gates, flip-flops, switches, LEDs and 7-segment displays, with live simulation, truth tables and timing diagrams.

- URL: https://qilingtools.com/en/physics/logic-circuit
- Category: Physics Tools (https://qilingtools.com/en/physics)
- Tags: [Physics](https://qilingtools.com/en/tags/physics), [Education](https://qilingtools.com/en/tags/education)
- Last updated: 2026-10-29
- Price: Free, no sign-up
- Privacy: Runs locally in the browser; files are never uploaded

Build digital circuits in the browser: place switches, clocks, AND, OR, NOT, NAND, NOR, XOR and XNOR gates, an SR latch and D, JK and T flip-flops, wire them up, and watch LEDs and 7-segment displays respond in real time. For combinational circuits the tool lists the truth table and simplifies each output to a minimal sum of products with the Quine–McCluskey method. Sequential circuits can run their clock or step half a period at a time, with a timing diagram. Examples include half and full adders, a 4-bit adder, a multiplexer, a decoder, a counter and a traffic light, and the circuit lives in the URL so you can share it.

## How to use

1. Pick an example, or start from a blank canvas and use Add part to place switches, gates and LEDs
2. Drag from one pin to another to draw a wire (on a phone you can also tap one pin, then the other)
3. Tap switches to flip them between 0 and 1 and watch the wires, LEDs and displays change
4. Read the truth table and minimal expression for combinational circuits; press Run clock for counters and check the timing diagram

## Features

- Eight gate types with 2–4 inputs, an SR latch and D, JK and T flip-flops; you can also build a latch from NOR gates
- Event-driven simulation that detects oscillation, such as a ring of an odd number of inverters, and highlights the parts involved
- Automatic truth table for combinational circuits (up to 6 inputs) with a simplified sum-of-products expression
- Clocks with adjustable frequency, run, pause and half-period stepping, with a timing diagram
- LEDs in four colours and a 7-segment display that shows 0–F from a 4-bit input
- Examples: half adder, full adder, 4-bit ripple adder, 4-to-1 multiplexer, 2-to-4 decoder, counter and traffic light, all shareable by link

## FAQ

### Why does my NOR-gate SR latch not oscillate?

Many simple simulators update every gate at once, which makes two cross-coupled NOR gates flip between 00 and 11 forever. This tool is event-driven: a gate is recomputed only when one of its inputs changes, and gates are evaluated one at a time, much like real gates whose delays always differ slightly. So the latch settles into one state. Oscillation is reported only for genuinely unstable circuits, such as a ring of an odd number of inverters.

### How are the truth table and expression produced?

Every switch is treated as an input and every LED as an output. The tool applies all 2ⁿ input combinations, simulates each from a fresh start until it settles, and records each LED. For each output the rows that give 1 (the minterms) go through the Quine–McCluskey algorithm to find prime implicants and a minimum cover, giving the simplest sum of products. A bar over a letter means NOT; you can also copy the expression in ¬A ∧ B form and paste it into the truth table tool.

### Why is there no truth table for some circuits?

A truth table describes a combinational circuit, whose outputs depend only on the present inputs. If the circuit contains a flip-flop, a latch, a clock or a feedback loop, the outputs also depend on what happened before: it is sequential and one table cannot describe it. Run the clock or step it and use the timing diagram instead. With more than six input switches the table would be too large, so it is skipped as well.

### What is the difference between D, JK and T flip-flops?

All three act on the rising clock edge. A D flip-flop stores the value at D into Q. A T flip-flop toggles Q when T = 1 and holds it when T = 0. A JK flip-flop holds on 00, resets on 01, sets on 10 and toggles on 11, so it can do everything the others can. The 3-bit counter example chains T flip-flops, clocking each stage from the previous Q̄, so Q0, Q1 and Q2 each halve the frequency and count up in binary.

### How do I save and share a circuit?

The parts, positions, labels and wires are compressed into the part of the URL after #, and nothing is uploaded to a server. Press Copy share link and send the address to someone, and they will see the same circuit. Bookmarking the address lets you come back and keep editing.

## Related tools

- [Unit Converter](https://qilingtools.com/en/math/unit): Free online unit converter: length, area, volume, weight, temperature, time, speed, data, pressure, energy and angle — one value converts every unit at once.
- [Vector Calculator](https://qilingtools.com/en/math/vector): Free online vector calculator for 2D and 3D: addition, scalar multiples, dot and cross products, magnitude, angle, unit vector and projections, with checks.
- [Significant Figures Calculator](https://qilingtools.com/en/math/significant-figures): Free online sig fig calculator: count significant figures digit by digit, round to N sig figs or decimals with six rounding modes, and compute by sig fig rules.
- [Tone Generator](https://qilingtools.com/en/audio/tone-generator): Free online tone generator: sine, square, sawtooth and triangle waves from 1 to 20,000 Hz, a note picker, sweeps, white/pink/brown noise and a WAV download.
- [Audio Spectrogram](https://qilingtools.com/en/audio/spectrogram): Free online spectrogram generator: see time, frequency and level from a Hann-windowed STFT, with FFT size, log axis, dB range and colour maps. Exports PNG.
- [Decibel Meter](https://qilingtools.com/en/audio/decibel): Free online decibel meter: measure noise with your mic in real time, A/C/Z weighting, fast/slow response, min/max/average/Leq, 60-second graph and calibration.
- [Physics Formula Calculator](https://qilingtools.com/en/physics/physics): Physics formulas solved with steps: SUVAT, projectiles, Newton’s laws, inclines, energy, Ohm’s law, resistors, RC, buoyancy, waves, lenses, gravity.
- [Fourier Series & FFT Visualizer](https://qilingtools.com/en/math/fourier): Fourier series coefficients and animated partial sums for square, sawtooth, triangle or any function (Gibbs), draw-your-own epicycles and FFT spectra.
