Logic Gates 101: AND, OR, NOT, NAND, NOR, XOR, and XNOR Explained

Every digital circuit — from a simple alarm system to a full processor — is built from a small handful of basic logic gates. Everything on this site, from K-map grouping to the auto-generated circuit diagrams, ultimately compiles down to these seven. Knowing them cold makes everything else click faster.

AND

Outputs 1 only when every input is 1. Two inputs, both required:

ABA AND B
000
010
100
111

OR

Outputs 1 when at least one input is 1:

ABA OR B
000
011
101
111

NOT

The only single-input gate here — simply flips its input:

ANOT A
01
10

NAND: AND, inverted

NAND is AND followed by NOT — 1 in every case except when both inputs are 1:

ABA NAND B
001
011
101
110

NAND is one of two "universal" gates — any Boolean function can be built from NAND gates alone, with no separate AND, OR, or NOT needed. See NAND/NOR-Only Circuit Implementation for exactly how that conversion works.

NOR: OR, inverted

NOR is OR followed by NOT — 1 only when both inputs are 0:

ABA NOR B
001
010
100
110

NOR is the other universal gate — equally capable of building any function alone.

XOR: "exactly one, not both"

XOR (exclusive OR) outputs 1 when its inputs differ — one is 1 and the other is 0, but not both the same:

ABA XOR B
000
011
101
110

XOR has a special relationship with K-maps worth knowing early: functions built from XOR produce a checkerboard truth table pattern that K-map grouping can't simplify at all — see the parity checker example for a fully worked demonstration.

XNOR: "the same"

XNOR is XOR inverted — 1 when both inputs match (both 0 or both 1):

ABA XNOR B
001
010
100
111

XNOR shows up naturally in equality-checking circuits — see the magnitude comparator example, where the A=B output is built on exactly this pattern.

All seven, side by side

ABANDORNANDNORXORXNOR
00001101
01011010
10011010
11110001

How these connect to everything else on this site

Every SOP expression this solver produces is literally a set of AND gates feeding one OR gate — that's what the auto-generated circuit diagram draws directly. Every POS expression is OR gates feeding one AND gate. The NAND/NOR conversion shows how to rebuild either using only universal gates, and the Boolean algebra laws are the formal rules governing how these seven gates combine and simplify.

Try it on the solver

Work through the examples above directly — enter the same minterms or expression into the live tool.

Open the K-Map Solver