Binary Logic Gate Simulator
Simulate AND, OR, NOT, XOR, NAND, NOR, XNOR gates with interactive inputs and full truth tables.
Updated
What is the Binary Logic Gate Simulator?
This interactive tool lets you simulate and explore the behaviour of the seven fundamental logic gates used in digital electronics: AND, OR, NOT, NAND, NOR, XOR, and XNOR. Click on any input to toggle between binary 0 and 1, and instantly see the gate's output update. A full truth table is automatically generated for the selected gate and number of inputs, with the currently active row highlighted.
Whether you're a student learning Boolean logic, a teacher demonstrating gate operations, or a developer verifying a quick combinational circuit idea, this simulator gives you instant, visual feedback without installing anything. Copy the entire truth table as TSV to paste into a spreadsheet or report.
How it works
- Choose a gate from the dropdown – pick any of the seven supported types (AND, OR, NOT, NAND, NOR, XOR, XNOR).
- Set the number of inputs (for all gates except NOT). You can simulate 2 to 6 inputs; the truth table grows automatically.
- Toggle inputs interactively – click on the round input buttons to switch between
0(white) and1(dark). The output updates in real time according to the gate's logic function. - Read the output shown to the right of the gate symbol. It reflects the current combination of inputs.
- Explore the truth table below the interactive area. Every possible input combination is listed, and the row matching your current inputs is highlighted.
- Copy the table using the Copy as TSV button to transfer the complete truth table into a spreadsheet or document.
All logic is computed client-side with pure functions – no network requests, no server. The simulator supports multi-input gates (more than two) by applying the Boolean operation across all inputs in the standard way:
- AND → all inputs must be
1for output1 - OR → at least one
1gives output1 - NAND → NOT of AND
- NOR → NOT of OR
- XOR → output is
1when an odd number of inputs are1 - XNOR → output is
1when an even number of inputs are1 - NOT → always a single-input inverter
Examples
Basic AND Gate
Two inputs (1 and 0) → AND gives output 0.
Three-input OR Gate
OR with three inputs (0, 0, 1) returns 1.
NOT Gate
Single input 1 → NOT gives 0.
XOR Gate
XOR with inputs 1 and 0 yields 1.
Frequently asked questions
What logic gates are supported?
What logic gates are supported?
The simulator includes the seven fundamental gates: AND, OR, NOT, NAND, NOR, XOR, and XNOR. Each gate behaves exactly as defined in Boolean algebra.
How does the truth table get generated?
How does the truth table get generated?
It enumerates all possible input combinations (2^n rows for n inputs) and computes the gate's output for each combination using pure logic functions. The table is automatically updated when you change the gate or the number of inputs.
Can I simulate gates with more than two inputs?
Can I simulate gates with more than two inputs?
Yes. For all gates except NOT, you can choose any number of inputs from 2 to 6. The multi‑input behavior follows the standard associative definition: AND requires all inputs to be 1; OR requires at least one 1; XOR checks the parity (odd number of 1s), and so on.
Why does the NOT gate only allow one input?
Why does the NOT gate only allow one input?
The NOT gate (inverter) is a unary operation: it has exactly one input. Adding more inputs would not make logical sense, so the simulator enforces this restriction.
Is the simulation accurate?
Is the simulation accurate?
Yes. All gates follow the internationally accepted Boolean truth tables. The computations are deterministic and cover every input combination exactly.
Can I copy the truth table for use in my own documents?
Can I copy the truth table for use in my own documents?
Absolutely. Use the Copy as TSV button above the table to copy the entire truth table, including headers and all rows, in tab-separated format. Paste it into any spreadsheet, text editor, or document.
Does this tool require an internet connection?
Does this tool require an internet connection?
No. Everything runs in your browser. Once the page loads, no further network requests are made, and your data never leaves your device.
Related tools
More utilities you might find handy.
.env File Generator
Quickly generate clean, properly-quoted .env files from key-value pairs — no more quoting errors or broken deployments.
.htaccess Redirect Builder
Generate error-free Apache .htaccess code for 301 redirects, HTTPS enforcement, and canonical URL routing.
ASCII Converter – Text to ASCII, Hex, Binary & Back
Convert text to ASCII codes and decode back in decimal, hex, binary, or octal — live, private, and 100% browser-based.