Skip to content
Other

Logic Gate Calculator

Select a gate and enter two binary inputs (0 or 1) to get the output instantly. The calculator also shows the full truth table for the chosen gate, a step-by-step explanation of the Boolean logic, and a side-by-side comparison of all seven fundamental gates for the same inputs. Covers AND, OR, NOT, NAND, NOR, XOR, and XNOR.

Your details

Choose the type of logic gate to evaluate.
First binary input. In digital circuits this is a voltage level: LOW (0) or HIGH (1).
Gate outputLOW (0)
0

The binary result (0 or 1) for the chosen gate and inputs.

AND output0
OR output1
NOT A output0
NAND output1
NOR output0
XOR output1
XNOR output0
AND0
OR1
NOT A0
NAND1
NOR0
XOR1
XNOR0

AND gate output: 0 (LOW)

  • Output is 1 only when BOTH inputs are 1.
  • With A = 1 and B = 0, the AND gate (&) produces 0.
  • For these inputs, 3 of the 7 fundamental gates produce a HIGH (1) output.

Next stepTo build a real circuit, map each gate to its IC chip: 74HC08 (AND), 74HC32 (OR), 74HC04 (NOT), 74HC00 (NAND), 74HC02 (NOR), 74HC86 (XOR).

Formula

AND:AB,OR:A+B,NOT:A,NAND:AB,NOR:A+B,XOR:AB,XNOR:ABAND: A \cdot B, \quad OR: A + B, \quad NOT: \overline{A}, \quad NAND: \overline{A \cdot B}, \quad NOR: \overline{A + B}, \quad XOR: A \oplus B, \quad XNOR: \overline{A \oplus B}

Worked example

For A = 1 and B = 0: AND = 1 AND 0 = 0; OR = 1 OR 0 = 1; NOT A = NOT 1 = 0; NAND = NOT(1 AND 0) = NOT 0 = 1; NOR = NOT(1 OR 0) = NOT 1 = 0; XOR = 1 XOR 0 = 1 (inputs differ); XNOR = NOT(1 XOR 0) = NOT 1 = 0.

What is a logic gate?

A logic gate is an electronic circuit that performs a Boolean operation on one or two binary inputs (0 or 1, also called LOW and HIGH, or FALSE and TRUE) and produces a single binary output. Logic gates are the fundamental building blocks of all digital electronics, from microprocessors and memory chips to networking equipment and consumer devices. Seven gates form the standard set: AND, OR, NOT, NAND, NOR, XOR, and XNOR. Every digital function, no matter how complex, can be implemented using combinations of these seven primitives.

The seven fundamental gates explained

AND outputs 1 only when ALL inputs are 1, modelling "both conditions must be true." OR outputs 1 when at least one input is 1, modelling "either condition can be true." NOT has a single input and inverts it: 0 becomes 1 and 1 becomes 0. NAND (Not AND) is the inverse of AND, outputting 0 only when all inputs are 1. NOR (Not OR) is the inverse of OR, outputting 1 only when all inputs are 0. XOR (Exclusive OR) outputs 1 when inputs differ; it is the basis of binary addition. XNOR (Exclusive NOR) outputs 1 when inputs match, the inverse of XOR. NAND and NOR are called universal gates because any Boolean function can be built from either one alone.

Universal gates: NAND and NOR

NAND and NOR are known as functionally complete or universal gates. This means that any logic circuit, regardless of complexity, can be built using only NAND gates or only NOR gates. Manufacturers exploit this property by producing a single gate type on a chip and using it to implement any required function, reducing the number of different parts in a design. For example, connecting the two inputs of a NAND gate together creates a NOT gate, and combining several NAND gates reproduces AND, OR, and all other functions. The same construction works symmetrically for NOR.

How to use this calculator

Choose a gate type from the drop-down, then set Input A and Input B to 0 or 1. The gate output updates instantly. The step-by-step panel walks through the Boolean operation exactly as the circuit would perform it, and the comparison bars show the output of all seven gates for the same two inputs side by side, so you can see at a glance how the gates relate. The truth table reference below lists all four possible input combinations for each gate. For the NOT gate only Input A is used; Input B is ignored and hidden.

Truth tables for all seven fundamental logic gates

ABANDORNOT ANANDNORXORXNOR
000011101
010111010
100101010
111100001

Each row is a unique combination of inputs A and B. For the NOT gate, only column A applies and B is ignored.

Frequently asked questions

What is the difference between AND and NAND?

AND outputs 1 only when both inputs are 1; NAND is the inverse, outputting 0 only when both inputs are 1 and 1 in every other case. Electronically, NAND is easier and cheaper to fabricate in CMOS technology, which is why many processor internals are built from NAND arrays rather than AND gates.

What is the difference between OR and NOR?

OR outputs 1 whenever at least one input is 1. NOR is the inverse: it outputs 1 only when both inputs are 0. Like NAND, NOR is a universal gate and can reproduce any Boolean function on its own.

What is XOR used for in real circuits?

XOR is the core of binary addition: the sum bit of a half-adder is A XOR B, and the carry bit is A AND B. XOR is also central to error detection and correction (checksums, CRC, Hamming codes), cryptographic stream ciphers, and RAID parity calculations, because flipping a bit in one operand always flips the corresponding output bit.

What does XNOR mean?

XNOR (Exclusive NOR) outputs 1 when both inputs are equal (both 0 or both 1) and 0 when they differ. It is the logical inverse of XOR and is sometimes called an equality comparator because a HIGH output means the inputs are identical.

What does it mean that NAND and NOR are universal gates?

A universal gate is one that can implement any Boolean logic function on its own, without needing any other gate type. Both NAND and NOR have this property. You can construct AND, OR, NOT, XOR, and every other gate from a network of only NAND gates, or from only NOR gates. This is exploited in chip design to minimise the number of distinct cell types needed in a standard cell library.

How do I read a truth table?

A truth table lists every possible combination of inputs in the left-hand columns and the corresponding gate output in the rightmost column. For a two-input gate there are four rows (2 to the power of 2 = 4 combinations): 00, 01, 10, and 11. Read each row as: if input A is the first digit and input B is the second digit, the gate output is the value in the output column.

What are real IC chips for each gate?

Standard 74HC logic family chips: 74HC08 (quad 2-input AND), 74HC32 (quad 2-input OR), 74HC04 (hex NOT/inverter), 74HC00 (quad 2-input NAND), 74HC02 (quad 2-input NOR), 74HC86 (quad 2-input XOR). XNOR is typically built from an XOR gate followed by an inverter, or available in the 74HC7266.

Sources

Written by Grace Mbeki, MSc Data Scientist & Educator · Nairobi, Kenya

Turning everyday numbers into clear, actionable answers for the decisions that matter most.

Search 3,500+ calculators

Loading search…