Logic Gate Calculator - Truth Tables and Output Bits

Logic gate calculator: pick AND, OR, NOT, NAND, NOR, XOR, or XNOR, toggle 2 or 3 input bits, and read the matching truth table and live output bit.

Updated: June 19, 2026 • Free Tool

Logic Gate Calculator

Pick the boolean function. NOT uses Input A only and ignores Input B and Input C.

Two inputs is the standard textbook case. Three inputs extends AND, OR, NAND, NOR, XOR, and XNOR.

First input bit. Always required. For NOT it is the only input that affects the output.

Second input bit. Used by every gate except NOT.

Third input bit. Only used when Number of Inputs is 3.

Results

Output Bit
0
Active Expression 0
Truth Table Rows 0rows

The matching row below is highlighted so the live output and the table always agree.

Truth Table

What Is a Logic Gate Calculator?

A logic gate calculator is a single-page tool that picks one of the seven common boolean functions (AND, OR, NOT, NAND, NOR, XOR, XNOR), reads a small set of 0 or 1 input bits, and returns the matching output bit along with the truth table for that gate.

  • Homework and exam checks: Verify the output row of a 2-input or 3-input gate without redrawing the truth table on paper.
  • Boolean algebra sketching: Test combinations of the seven gates while designing a combinational circuit.
  • Truth-table teaching: Show how a 2-input gate's 4 rows extend to 8 rows for a 3-input gate.
  • Quick reference for digital design: Refresh the rule for XOR, XNOR, or NOT when the truth table is the only thing you need.

Logic gates are the building blocks of every digital circuit, from the adder inside a CPU to the flip-flop that stores one bit. Each gate is a deterministic function on its inputs, so a calculator can answer every question about a gate with a single lookup.

When the question is no longer about a single gate but about a boolean expression that combines several of them, Boolean Algebra Calculator evaluates the full expression and prints the truth table for the variables.

How the Logic Gate Calculator Works

The calculator reads the gate selector and the input bits, applies the boolean rule for that gate, and reports the output bit, the active expression, and the matching truth table. Every row of the truth table is generated from the same rule so the live result always matches the highlighted row.

output = GATE(inputA, inputB[, inputC]) where GATE is AND, OR, NOT, NAND, NOR, XOR, or XNOR
  • gateType: The boolean function selected from the dropdown. Determines which truth-table row is active.
  • numInputs: How many inputs the gate reads. 2 is standard; 3 extends AND, OR, NAND, NOR, XOR, and XNOR.
  • inputA: First input bit. Always required. For the NOT gate it is the only input that affects the output.
  • inputB: Second input bit. Used by every gate except NOT. Ignored when numInputs is 1.
  • inputC: Third input bit, used only when numInputs is 3. Always 0 or 1.

The seven gates are defined by their truth tables. AND returns 1 only when every input is 1; OR returns 1 when at least one input is 1; NOT flips Input A from 1 to 0 or 0 to 1. NAND and NOR flip the AND/OR outputs, and XOR returns 1 when the inputs have an odd number of 1s while XNOR returns 1 when they match.

For three inputs, the rules extend naturally: AND of A, B, C is 1 only when all three are 1; OR is 0 only when all three are 0; XOR is 1 when the count of 1s is odd. The calculator applies those rules on the live input bits, so the result matches the truth table row you can see on the page.

AND of 1 and 1 (2 inputs)

Gate = AND, numInputs = 2, Input A = 1, Input B = 1

1 AND 1 is true only when both inputs are 1.

Output bit: 1. Active expression: 1 AND 1 = 1.

The single row of the AND truth table where both inputs are 1 returns 1. Every other row returns 0.

XOR of three 1s (3 inputs, odd parity)

Gate = XOR, numInputs = 3, Input A = 1, Input B = 1, Input C = 1

XOR counts the 1 bits modulo 2. With three 1s the count is 3, which is odd.

Output bit: 1. Active expression: 1 XOR 1 XOR 1 = 1.

XOR of an odd number of 1s is 1, which is the same rule the even parity check uses in reverse.

According to the Wolfram MathWorld AND entry, logical AND yields true if all conditions are true and false if any condition is false, which is the rule the calculator applies to the AND gate.

According to the Wolfram MathWorld OR entry, logical OR yields true if at least one operand is true and false only when every operand is false, which is the rule the calculator applies to the OR gate.

Key Concepts Behind the Logic Gates

Four short ideas explain why these seven functions are the standard building blocks of digital logic. Once they are clear, the truth table stops being a memorization exercise.

Boolean algebra

Every gate is a boolean function that maps a fixed number of inputs to one output bit. AND corresponds to multiplication, OR corresponds to addition capped at 1, and NOT corresponds to inversion.

Truth table as a contract

A truth table is the full definition of a gate. Two-input AND, OR, and XOR each have 4 rows. A 3-input gate has 8 rows. The active row in the calculator is the row the inputs point to.

Universal gates (NAND and NOR)

NAND and NOR are called universal because any other boolean function can be built from NAND gates alone, or from NOR gates alone. A real CPU is mostly NAND gates.

XOR and XNOR as comparators

XOR returns 1 when its inputs differ, and XNOR returns 1 when its inputs match. XOR is the half-adder's sum bit, XNOR is the equality comparator inside an ALU.

These four concepts are the bridge between a gate's name and the circuit it represents. The names are short, but each one is a real component on a real chip.

When you already know which boolean function you want to evaluate, the And Calculator applies the same idea to bitwise AND between two numbers so you can compare the gate-by-gate rule to the column-by-column rule.

How to Use the Logic Gate Calculator

Choose a gate, choose how many inputs it should read, and toggle each input bit. The result panel updates in real time and the truth table highlights the active row.

  1. 1 Pick the logic gate: Use the Logic Gate dropdown to select AND, OR, NOT, NAND, NOR, XOR, or XNOR. The dropdown text describes what each gate does.
  2. 2 Pick the number of inputs: Choose 2 inputs for the standard textbook case or 3 inputs when the circuit reads three bits. NOT always uses Input A only.
  3. 3 Set Input A, B, and C: Set each bit to 0 (false) or 1 (true). Input C is only consulted when Number of Inputs is 3.
  4. 4 Read the output bit: The highlighted Output Bit row shows the live result. The Active Expression row names the gate and lists the input bits, for example 1 XOR 0 = 1.
  5. 5 Verify against the truth table: The truth table on the page lists every input combination for the chosen gate and number of inputs. The row whose inputs match your selection is the same row the live result came from.

Example: a student is asked to confirm that an XNOR gate outputs 1 when both inputs are equal. They select XNOR, leave Number of Inputs at 2, set Input A to 1 and Input B to 1, and the result panel reads 1. Switching Input B to 0 drops the result to 0, which matches the XNOR rule.

When the next step is to turn the bit pattern you just built into a printable character, Binary to Text converts each 8-bit group into the matching ASCII character.

Benefits of Using This Logic Gate Calculator

Logic gates are simple by definition, but combining seven gates and two input sizes by hand is where small mistakes creep in. The calculator keeps the rule, the inputs, and the truth table consistent.

  • Seven gates in one place: AND, OR, NOT, NAND, NOR, XOR, and XNOR all sit behind a single dropdown, replacing seven separate mini-tables with one place to switch between them.
  • Live output for any input combination: Toggle the inputs and the output bit updates instantly. There is no chance to read the wrong row from a hand-drawn truth table.
  • Truth table next to the numeric result: The full truth table is rendered on the page so you can confirm the output against the matching row.
  • Two-input and three-input modes: Switch between the standard 4-row table and the 8-row table for 3 inputs, which covers XOR-of-three parity checks and AND-of-three enable signals.
  • NOT gate handled correctly: When the gate is NOT, the calculator applies the inversion to Input A only, so you do not have to clear the other input bits to use it.
  • Same rule for circuit sketches and homework: Whether sketching a circuit or answering a textbook problem, the rule matches IEEE graphic symbols for logic functions.

The biggest practical win is consistency: the live output bit and the truth table row always agree because they are generated from the same boolean function.

When you also need the parity bit that goes with a binary message, Even Parity Calculator generates or checks the parity bit in the same one-page style.

Factors That Affect the Result and Its Limits

The boolean rule for each gate is fixed, but four choices about the inputs change what the live result means.

Gate selection

AND returns 1 only when every input is 1. OR returns 1 when at least one input is 1. NAND and NOR flip those rules. XOR returns 1 when the inputs differ and XNOR returns 1 when they match.

Number of inputs

Two inputs gives the standard 4-row truth table. Three inputs extends it to 8 rows and changes rules like XOR, which counts the 1 bits modulo 2 rather than just comparing two values.

NOT gate ignores Input B and Input C

NOT is a single-input gate. The calculator always applies NOT to Input A regardless of Input B and Input C, and the truth table collapses to the two rows that only use A.

Boolean inputs are always 0 or 1

Inputs outside 0 or 1 are treated as 0 because boolean logic only has two values.

  • The calculator covers single gates, not full expressions. For something like (A AND B) OR (C AND D), use a boolean algebra tool that supports multiple operators in one expression.
  • Outputs are not propagated through a circuit. To model how one gate feeds another, evaluate the first gate, then feed its output into the next gate manually.

Within those limits the calculator matches the textbook rule for every one of the seven gates, and the live output matches the highlighted row.

According to All About Circuits: Logic Gates, XOR outputs 1 when its inputs differ and XNOR outputs 1 when they match, which is the rule the calculator applies.

When you need to evaluate a longer expression rather than a single gate, Truth Table Generator takes a boolean expression and prints the truth table for the named variables.

Logic gate calculator showing the gate selector, 0 or 1 input toggles, the live output bit, and the matching truth table for the chosen gate.
Logic gate calculator showing the gate selector, 0 or 1 input toggles, the live output bit, and the matching truth table for the chosen gate.

Frequently Asked Questions

Q: What is a logic gate calculator?

A: A logic gate calculator is a one-page tool that picks one of the seven common boolean functions (AND, OR, NOT, NAND, NOR, XOR, XNOR), reads a small set of 0 or 1 input bits, and returns the matching output bit together with the truth table for that gate.

Q: How do you read a 2-input AND gate truth table?

A: The 2-input AND truth table has four rows: (A=0, B=0) returns 0, (0, 1) returns 0, (1, 0) returns 0, and (1, 1) returns 1. Only the row where both inputs are 1 produces a 1; the other three rows all produce 0.

Q: What is the difference between XOR and XNOR?

A: XOR outputs 1 when its two inputs differ and 0 when they are the same. XNOR is the exact complement: it outputs 1 when the inputs match and 0 when they differ. For three or more inputs, XOR returns 1 when the count of 1s is odd and XNOR returns 1 when the count is even.

Q: Can a logic gate calculator handle 3 inputs?

A: Yes. Switching Number of Inputs to 3 extends the truth table from 4 rows to 8 rows and applies the gate rule to Input A, Input B, and Input C. NOT still only uses Input A, regardless of the input count selector.

Q: What does a NAND gate output for inputs 0 and 1?

A: NAND outputs the complement of AND. For inputs 0 and 1, AND returns 0, so NAND returns 1. NAND only returns 0 on the single row where every input is 1, which is why NAND is treated as a universal gate in real circuits.

Q: How does a NOT gate differ from a buffer gate?

A: A NOT gate flips its single input: 1 becomes 0 and 0 becomes 1. A buffer gate (sometimes called YES) copies its input unchanged: 1 stays 1 and 0 stays 0. The calculator covers NOT but not the buffer gate because the buffer is just a wire on a schematic.