Logic Gate Calculator (Truth Tables)

Quick answer

The logic gate calculator gives the output of AND, OR, NOT, NAND, NOR, XOR, XNOR and buffer gates with two to four inputs, along with the Boolean expression, the full truth table with your inputs highlighted and the gate's logic symbol.

Output (Y)
0
Boolean expression
Y = A · B
Summary
1 of 4 input combinations give Y = 1
Truth table
A B Y ───────────────────────── 0 0 0 0 1 0 1 0 0 ◀ your inputs 1 1 1
Logic symbol
How this gate works
An AND gate outputs 1 only when every input is 1. It behaves like switches in series: current flows only if all are closed.

Logic gates are the building blocks of every digital circuit, from a doorbell timer to a CPU with billions of transistors. Each gate takes one or more binary inputs – 0 (low, false) or 1 (high, true) – and produces one binary output according to a fixed rule from Boolean algebra.

AND outputs 1 only when all inputs are 1; OR outputs 1 when any input is 1; NOT simply inverts its input. Adding an inverting bubble to AND and OR gives NAND and NOR, which are “universal”: any logic function can be built from NAND gates alone, or from NOR gates alone, which is why they dominate real chip design. XOR outputs 1 when an odd number of inputs are 1 – for two inputs, when they differ – making it the heart of binary adders, parity generators and simple encryption. XNOR is its complement and acts as an equality detector. A buffer passes its input unchanged, restoring signal strength.

A truth table lists the output for every combination of inputs: 4 rows for two inputs, 8 for three and 16 for four. The calculator generates it for the chosen gate and marks the row matching the inputs you set.

How to use the Logic Gate Calculator

  1. Logic gate
  2. Number of inputs
  3. Input A
  4. Input B
  5. Input C
  6. Input D

Everything is calculated in your browser, so results appear instantly and nothing you type is sent to a server.

How it works

Choose a gate, the number of inputs and the value of each input. The tool applies the gate’s rule to your inputs and to every possible input combination to build the truth table, and draws the standard (distinctive-shape) symbol.

Worked example

A two-input AND gate with A = 1 and B = 0 outputs 0, because AND needs every input high. A NAND gate with the same inputs outputs 1, an OR outputs 1 and an XOR outputs 1 (the inputs differ). A three-input XOR with A = 1, B = 0, C = 1 outputs 0, because two of its inputs – an even number – are 1.

Two-input truth tables

A B AND OR NAND NOR XOR XNOR
0 0 0 0 1 1 0 1
0 1 0 1 1 0 1 0
1 0 0 1 1 0 1 0
1 1 1 1 0 0 0 1

Formula

AND: Y = A·B · OR: Y = A + B · NOT: Y = Ā · NAND: Y = ¬(A·B) · NOR: Y = ¬(A + B) · XOR: Y = A ⊕ B = A·B̄ + Ā·B · XNOR: Y = ¬(A ⊕ B)

Worked example

Inputs — Logic gate: AND; Number of inputs: 2; Input A: 1; Input B: 0.
Results — Output (Y) = 0; Boolean expression = Y = A · B; Summary = 1 of 4 input combinations give Y = 1; Truth table = A B Y
─────────────────────────
0 0 0
0 1 0
1 0 0 ◀ your inputs
1 1 1 ; How this gate works = An AND gate outputs 1 only when every input is 1. It behaves like switches in series: current flows only if all are closed..

Key terms

Truth table
Table of the output for every input combination.
Boolean algebra
Algebra of true/false values with AND, OR and NOT.
Universal gate
A gate type from which all other logic functions can be built.
Inverting bubble
Small circle on a symbol showing the output (or input) is inverted.

Frequently asked questions

What is a logic gate?

An electronic circuit that produces a binary output from one or more binary inputs according to a Boolean rule.

Which gates are universal?

NAND and NOR – any logic circuit can be built from either one alone.

How do I make an AND gate from NAND gates?

Feed A and B into a NAND, then feed its output into both inputs of a second NAND (acting as NOT).

What is the difference between OR and XOR?

OR gives 1 when at least one input is 1; XOR gives 1 only when an odd number are 1, so 1 XOR 1 = 0.

How many rows does a truth table have?

2ⁿ for n inputs: 4 for two inputs, 8 for three, 16 for four.

What does a multi-input XOR do?

It outputs 1 for an odd number of 1s – a parity checker.

Sources

  1. Logic gate – Wikipedia
  2. Boolean algebra – Wikipedia

Cite this calculator

Speedy Calculator. (2026). Logic Gate Calculator (Truth Tables). Speedy Calculator. https://speedycalculator.com/calculators/other/logic-gate/