Boolean Logic Simulator

The brain of the computer. Interactive simulator for AND, OR, XOR, and Universal Gates. Visualize the flow of electricity and truth.

Logic Gate Simulator

Select a gate and toggle inputs to see real-time logic.

Circuit Visualization
Input A0
Input B0
Output0

AND Gate

Output is ON only if BOTH inputs are ON.

Live Truth Table

ABOUT
000
010
100
111

Logic Gate Reference

Quick lookup for all standard operations.

AND

Output is ON only if BOTH inputs are ON.

OR

Output is ON if AT LEAST ONE input is ON.

XOR

Output is ON if inputs are DIFFERENT.

NOT

Inverts the input (Single input only).

NAND

Output is OFF only if BOTH inputs are ON.

NOR

Output is ON only if BOTH inputs are OFF.

How Computers "Think"

At its core, a computer is not intelligent. It is just a massive collection of billions of tiny switches called Logic Gates.

These gates take electrical signals (High or Low) and make simple decisions based on strict rules. This system of rules is called Boolean Algebra, invented by George Boole in the 1800s—long before the first electronic computer was ever built.

By chaining these simple "Yes/No" decisions together, computers can perform complex math, render 3D graphics, and even run Artificial Intelligence models.

The Universal Gates (NAND/NOR)

Did you know you can build an entire computer using only NAND gates?

A NAND gate (Not-AND) outputs False only if both inputs are True. It turns out that by connecting NAND gates in specific patterns, you can recreate the behavior of AND, OR, and NOT gates.

Fun Fact: Most SSDs (Solid State Drives) use "3D NAND" technology because it is efficient to manufacture layers of the same repeating component.

The XOR Gate & Addition

The Exclusive-OR (XOR) gate is the secret to math.

Think about binary addition: 0+0=0, 1+0=1, 0+1=1. This matches the XOR logic perfectly!

But what about 1+1=10? The "0" part is the XOR output, and the "1" (Carry) is calculated by an AND gate. This combination (XOR + AND) creates a Half Adder, the most basic math circuit.

Logic in Programming

If you code (JS, Python, C++), you use Boolean Logic every day.

// The AND Operator (&&)
if (user.isLoggedIn && user.hasPaid) {
  showPremiumContent();
}
Both must be true to run.
// The OR Operator (||)
if (user.isAdmin || user.isModerator) {
  enableDeleteButton();
}
Only one needs to be true.
// The NOT Operator (!)
if (!isValid) {
  showError();
}
Inverts the boolean value.

Why "Boolean"?

The system is named after George Boole (1815–1864), an English mathematician. He published "The Laws of Thought", proposing that logic could be reduced to simple algebraic equations. He had no idea that 100 years later, his math would underpin the digital revolution.


Frequently Asked Questions

What is a Logic Gate?

A logic gate is a physical device implementing a Boolean function. It performs a logical operation on one or more binary inputs (0 or 1) and produces a single binary output. They are the fundamental building blocks of all modern digital computers.

What is the difference between AND and OR?

The AND gate is strict: it only outputs "True" (1) if ALL inputs are True. The OR gate is flexible: it outputs "True" (1) if AT LEAST ONE input is True. Think of AND as "Series circuit" and OR as "Parallel circuit".

What makes the XOR (Exclusive OR) gate special?

XOR outputs True only if the inputs are DIFFERENT. If both are 0 or both are 1, it outputs False. This specific property makes XOR the core component for binary addition (Half Adders) and cryptography.

What are "Universal Gates"?

NAND and NOR are called "Universal Gates" because you can build ANY other gate (AND, OR, NOT, XOR) using only combinations of NANDs or only combinations of NORs. This is why flash memory is made of NAND cells—it is cheaper to manufacture just one type of gate.

How do computers represent True and False physically?

In hardware, logic states are voltage levels. Typically, +5V or +3.3V represents "True" (Logic 1), and 0V (Ground) represents "False" (Logic 0). Transistors act as switches to control this flow of electricity.

What are De Morgan's Laws?

De Morgan's Laws describe how to simplify Boolean expressions. 1) NOT (A AND B) = (NOT A) OR (NOT B). 2) NOT (A OR B) = (NOT A) AND (NOT B). These rules help engineers simplify circuit designs to use fewer chips.

What is a Truth Table?

A Truth Table is a mathematical chart that lists all possible combinations of inputs for a logic circuit and shows the resulting output for each. For a 2-input gate, there are 4 combinations (00, 01, 10, 11).

Why is the NOT gate also called an Inverter?

Because it literally "inverts" the signal. If you put a voltage in (1), it connects the output to ground (0). If you put ground in (0), it connects output to voltage (1). It flips the bit.

What is Boolean Algebra?

Boolean Algebra is a branch of mathematics where variables can only have two values: True or False. Unlike elementary algebra where variables are numbers, here operations are logical (conjunction, disjunction, negation).

How many transistors are in a Logic Gate?

It depends on the technology (CMOS is standard). A NOT gate needs 2 transistors. AND/OR gates typically use 6 transistors. An XOR gate is more complex and might use 8-12 transistors.

What is a "buffer" gate?

A buffer gate has one input and one output, and it does... nothing to the logic (Output = Input). It is used to strengthen a weak electrical signal so it can travel further or drive more components (fan-out).

What is the "Carry" bit in addition?

When adding binary numbers (e.g. 1 + 1), the result is 2 (binary 10). The "0" is the Sum, and the "1" is the Carry. An AND gate is used to calculate this Carry bit in digital adders.

What is TTL vs CMOS?

TTL (Transistor-Transistor Logic) and CMOS (Complementary Metal-Oxide-Semiconductor) are different technologies for building gates. CMOS is dominant today because it consumes almost zero power when static, whereas TTL consumes power constantly.

Can logic gates have more than 2 inputs?

Yes! A 3-input AND gate outputs 1 only if Inputs A, B, AND C are all 1. You can have 4-input, 8-input, or even wider gates, though physically they are often built by chaining smaller gates together.

What is a Flip-Flop?

A Flip-Flop is a circuit made by connecting logic gates in a feedback loop. This allows it to "remember" a state (0 or 1) even after the input changes. This is how computer RAM and registers are built.