Skip to content

Instantly share code, notes, and snippets.

@kjanat
Last active May 25, 2025 19:02
Show Gist options
  • Select an option

  • Save kjanat/cf58f9f30e3cfb5dbe535e48e9c03e8f to your computer and use it in GitHub Desktop.

Select an option

Save kjanat/cf58f9f30e3cfb5dbe535e48e9c03e8f to your computer and use it in GitHub Desktop.
Truth table for 2-input logic gates (AND, OR, NAND, NOR, XOR, XNOR) with links to Wikipedia and explanations for T (true) and F (false).

Truth table for logic gates 1

Here is a truth table that gives definitions of each of the 6 possible 2-input logic gate functions of two Boolean variables $P$ and $Q$:

$P$ $Q$ $P$$Q$ $P$$Q$ $P$$Q$ $P$$Q$ $P$$Q$ $P$$Q$
$\text{T}$ $\text{T}$ $\text{T}$ $\text{T}$ $\text{F}$ $\text{F}$ $\text{F}$ $\text{T}$
$\text{T}$ $\text{F}$ $\text{F}$ $\text{T}$ $\text{T}$ $\text{F}$ $\text{T}$ $\text{F}$
$\text{F}$ $\text{T}$ $\text{F}$ $\text{T}$ $\text{T}$ $\text{F}$ $\text{T}$ $\text{F}$
$\text{F}$ $\text{F}$ $\text{F}$ $\text{F}$ $\text{T}$ $\text{T}$ $\text{F}$ $\text{T}$
Name
(function)
AND
(conjunction)
OR
(disjunction)
NAND
(non-conjunction)
NOR
(non-disjunction)
XOR
(non-equivalence)
XNOR
(equivalence)

where $\text{T}$ means true and $\text{F}$ means false.

Footnotes

  1. Wikipedia

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment