Free Online Engineering Tools

Logic Gate Calculator — AND, OR, NOT, NAND, NOR, XOR, XNOR

Explore digital logic hands-on. Pick a gate, flip the inputs, and instantly see the output, the live gate symbol and the full truth table — with the row matching your inputs highlighted.

1Pick a Gate & Set Inputs
Logic Gate
🔢Inputs (click to toggle)
A1
B0
💡
Pro Tip
Click A or B to flip between 0 and 1. NOT and BUFFER use only input A. The truth-table row matching your inputs is highlighted in orange.
2Live Gate Symbol
3Truth Table
4Result
Output (Y)
0
Gate
AND
Boolean Expression
Y = A · B
Logic Statement
1 AND 0 = 0
What This Gate Does

What Is a Logic Gate?

A logic gate is the fundamental building block of every digital circuit. It takes one or more binary inputs — each either 0 (low) or 1 (high) — and produces a single binary output according to a fixed Boolean rule. Chain gates together and you can build anything digital: adders, memory, and ultimately the processor running this page. This logic gate calculator lets you pick any of the seven standard gates (plus a buffer), toggle the inputs, and instantly see the output, the live IEEE gate symbol, and the complete truth table with your current input row highlighted.

How to Use This Logic Gate Calculator

1. Choose a gate from AND, OR, NOT, NAND, NOR, XOR, XNOR or BUFFER. 2. Click the A and B toggles to set each input to 0 or 1 (NOT and BUFFER use only input A). 3. Read the output — the gate symbol lights green for high inputs and orange when the output is 1. 4. Check the truth table, where the row matching your inputs is highlighted in orange. The Boolean expression and a plain-language statement update alongside.

Logic Gate Truth Tables Explained

A truth table lists every possible input combination and the resulting output. A two-input gate has four rows (00, 01, 10, 11); a one-input gate like NOT has two. Here is every gate, its Boolean expression, and its full truth table.

AND Gate Truth Table

The AND gate outputs 1 only when both inputs are 1. Boolean: Y = A · B. Think of switches in series — all must be closed.

ABY
000
010
100
111

OR Gate Truth Table

The OR gate outputs 1 when at least one input is 1. Boolean: Y = A + B. Think of switches in parallel — any one closes the circuit.

ABY
000
011
101
111

NOT Gate (Inverter) Truth Table

The NOT gate has a single input and flips it: 0 becomes 1, 1 becomes 0. Boolean: Y = ¬A.

AY
01
10

NAND Gate (The Universal Gate) Truth Table

NAND is AND followed by NOT: it outputs 0 only when both inputs are 1, otherwise 1. Boolean: Y = ¬(A · B). It is universal — every other gate can be built from NANDs alone.

ABY
001
011
101
110

NOR Gate (The Universal Gate) Truth Table

NOR is OR followed by NOT: it outputs 1 only when both inputs are 0. Boolean: Y = ¬(A + B). Like NAND, it is a universal gate.

ABY
001
010
100
110

XOR Gate (Exclusive OR) Truth Table

XOR outputs 1 when the inputs are different and 0 when they are the same. Boolean: Y = A ⊕ B. It is the heart of binary addition and parity checks.

ABY
000
011
101
110

XNOR Gate (Exclusive NOR) Truth Table

XNOR is the inverse of XOR: it outputs 1 when the inputs are equal. Boolean: Y = ¬(A ⊕ B). It works as an equality detector.

ABY
001
010
100
111

Understanding Boolean Algebra Behind the Gates

Every gate corresponds to a Boolean operation. AND is written as a product (A · B), OR as a sum (A + B), and NOT as an overbar or ¬. From just these three, and identities like De Morgan's laws — ¬(A · B) = ¬A + ¬B and ¬(A + B) = ¬A · ¬B — you can simplify any digital circuit. Boolean algebra is what lets engineers reduce a tangle of gates down to the fewest components, and it is the theory the whole of digital design rests on. To work with full binary numbers rather than single bits, use the Binary Calculator; for per-bit AND/OR/XOR across whole numbers, see the Bitwise Calculator.

Where Logic Gates Are Used

Logic gates underpin all of digital electronics: arithmetic units (half and full adders built from XOR and AND), multiplexers and decoders, flip-flops and memory cells, control logic in every CPU, and hobby circuits using 7400-series chips. Once you understand single gates here, switch number bases in the Number System Converter or shift bits in the Bit Shift Calculator.

Next step: Ready to combine gates into real circuits? Build adders and see per-bit logic in the Bitwise Calculator, or do full binary math in the Binary Calculator.

Parity generators are built from XOR gates. See it in action in the Parity Bit Calculator, which computes even and odd parity for any binary data.

See parity applied to error correction in the Hamming Code Calculator, which encodes data and corrects single-bit errors using the syndrome.

Need a table for a whole expression, not one gate? The Truth Table Generator builds the full truth table for any Boolean formula, with intermediate step columns.

Simplifying a multi-gate circuit? The K-Map Solver minimizes Boolean expressions to the fewest gates using a Karnaugh map.

XOR gates are what build a Gray code converter. See the conversion step by step in the Gray Code Converter.

Frequently Asked Questions

What is the difference between XOR and XNOR?

XOR (exclusive OR) outputs 1 when its two inputs are different; XNOR outputs 1 when they are the same. XNOR is simply XOR with an inverter on the output, which is why it acts as an equality detector.

Why are NAND and NOR called universal gates?

Because every other gate — AND, OR, NOT and the rest — can be built using only NAND gates, or only NOR gates. A NOT, for instance, is a NAND with its inputs tied together. Manufacturing one gate type in bulk is cheaper, so real chips use huge numbers of NANDs.

What is the difference between AND and OR gates?

AND outputs 1 only when all inputs are 1; OR outputs 1 when at least one input is 1. AND means "both required", OR means "either will do".

What is a logic gate?

A basic digital building block that takes binary inputs (0 or 1) and produces one binary output by a Boolean rule. The seven common gates are AND, OR, NOT, NAND, NOR, XOR and XNOR.

What is a truth table?

A table listing every input combination and the resulting output. A two-input gate has four rows (00, 01, 10, 11); NOT has two. This tool highlights the row matching your current inputs.

How many inputs can a logic gate have?

NOT has exactly one input; the others can have two or more. Two-input versions are most common. A 3-input AND, for instance, outputs 1 only when all three inputs are 1.