Logic Gate Calculator

Evaluate AND, OR, NOT, NAND, NOR, XOR, XNOR, and BUFFER logic gates for binary inputs A and B, with the output and full truth table.

Quick Facts

Method
Boolean algebra — each gate maps binary inputs to a single binary output
AND = A·B, OR = A+B, XOR = A⊕B; NAND and NOR are their inverses.
Universal gates
NAND and NOR can each build any Boolean function alone
That is why many chips are fabricated using only one gate type.

Your Results

Calculated
Output (Y)
-
0 = LOW, 1 = HIGH
Evaluated expression
-
This gate with your inputs
Truth table highs
-
Rows where output = 1
Boolean form
-
Standard notation for this gate

Ready

Choose a gate and binary inputs, then press Calculate.

Understanding logic gates and Boolean algebra

A logic gate is the fundamental building block of digital electronics. It takes one or more binary inputs — each either 0 (LOW, false) or 1 (HIGH, true) — and produces a single binary output according to a fixed rule from Boolean algebra. Wire enough gates together in the right pattern and you get an adder, a memory cell, a CPU, or any other digital circuit. This calculator evaluates the eight standard gates for the two inputs you choose and shows the resulting output alongside the gate's complete truth table.

The eight standard gates and their formulas

  • AND — Y = A · B. Output is 1 only when both inputs are 1.
  • OR — Y = A + B. Output is 1 when at least one input is 1.
  • NOT — Y = A′ (also written ¬A). A single-input gate that inverts its one input; input B is not used.
  • NAND — Y = (A · B)′. AND followed by an inverter; output is 0 only when both inputs are 1.
  • NOR — Y = (A + B)′. OR followed by an inverter; output is 1 only when both inputs are 0.
  • XOR (exclusive OR) — Y = A ⊕ B. Output is 1 when the inputs differ (one 0, one 1).
  • XNOR (exclusive NOR) — Y = (A ⊕ B)′. Output is 1 when the inputs match (equivalence).
  • BUFFER — Y = A. A single-input gate that passes its input through unchanged; used to restore signal strength or add a small delay, not for logic.

Truth tables at a glance

For the six two-input gates, there are four possible input combinations (A,B): (0,0), (0,1), (1,0), (1,1). Reading the output column for each combination gives the full truth table:

  • AND: 0, 0, 0, 1 — only one row is HIGH.
  • OR: 0, 1, 1, 1 — three rows are HIGH.
  • NAND: 1, 1, 1, 0 — the exact inverse of AND.
  • NOR: 1, 0, 0, 0 — the exact inverse of OR.
  • XOR: 0, 1, 1, 0 — HIGH exactly when A and B disagree.
  • XNOR: 1, 0, 0, 1 — HIGH exactly when A and B agree.

NOT and BUFFER only have two rows, one for each value of A: NOT gives 1, 0 (inputs 0 then 1); BUFFER gives 0, 1.

Why NAND and NOR are called "universal" gates

NAND and NOR are special because either one, used by itself, can reproduce every other gate — including AND, OR, and NOT. For example, wiring both inputs of a NAND gate to the same signal produces a NOT gate, and combining NAND gates in the right pattern produces AND and OR. This is why real chips are frequently fabricated using large arrays of a single gate type: it simplifies manufacturing while still allowing any Boolean function to be built.

How to read this calculator

  1. Pick a gate from the Logic gate dropdown.
  2. Set Input A and Input B to 0 or 1 (B is ignored for the single-input NOT and BUFFER gates).
  3. Press Calculate to see the output, the evaluated expression, how many truth-table rows are HIGH for that gate, and the gate's standard Boolean notation.

Frequently Asked Questions

What is a logic gate?
A logic gate is a basic building block of digital circuits that takes one or more binary inputs (0 = LOW/false, 1 = HIGH/true) and produces a single binary output based on a fixed Boolean rule. AND, OR, NOT, NAND, NOR, XOR, XNOR, and BUFFER are the standard gates; every digital chip, from a simple counter to a CPU, is built by wiring these gates together.
What is the difference between AND, OR, and XOR?
AND (Y = A AND B) outputs 1 only when both inputs are 1. OR (Y = A OR B) outputs 1 when at least one input is 1. XOR (exclusive OR) outputs 1 only when the two inputs are different (one 0 and one 1); it outputs 0 when both inputs match.
How do NAND and NOR relate to AND and OR?
NAND is AND followed by an inverter, so it is 0 only when both inputs are 1 and 1 otherwise. NOR is OR followed by an inverter, so it is 1 only when both inputs are 0. Both are called universal gates because any Boolean function, including AND, OR, and NOT themselves, can be built from NAND gates alone or from NOR gates alone, which is why chips often standardize on one of them.
Can I use this calculator on mobile?
Yes, it works on any device. Pick a gate, set inputs A and B (B is ignored for the single-input NOT and BUFFER gates), and press Calculate to see the output and the gate's full truth table.