Skip to content
ohmplay. Electronics
laboratory

Home / Tools / Logic gates

Experiment 005 / Digital logic

Logic gates

Toggle inputs, compare seven gates and follow each combination in its truth table.

Workbench / Ideal model ● In your browser
01 / Adjust the inputs
Digital inputs
Try an example
02 / Follow the signal Rectangular symbols
A = 0 B = 0 & 0 Output Y
Output Y 0
Operation AND

AND is 1 only when both inputs are 1.

Truth table · the arrow marks the active combination
Active A B Y
→ 0 0 0
0 1 0
1 0 0
1 1 1

Use it in your classroom

Share this exercise with its current values. The link contains only numbers and model options; do not add names or email addresses.

The code includes a text link to the full explanation outside the frame. Animation starts paused. Adjust the iframe height if your platform needs it.

Two conditions for one output

Imagine two signals: A means “permission” and B means “button pressed.” With AND, Y is 1 only when both are 1. If either is 0, the output is 0. The truth table lists all four possibilities, including those you are not currently testing.

Switch to XOR: with A = 1 and B = 1, the output becomes 0. XOR means the inputs differ, not just that one or more are active. This distinction is useful in digital comparators and adders.

Seven operations, one convention

  • AND (&): all inputs must be 1.
  • OR (≥1): at least one input must be 1.
  • NOT (1 with inversion bubble): inverts its single input.
  • NAND: inverts the AND output.
  • NOR: inverts the OR output.
  • XOR (=1): exactly one of the two inputs is 1.
  • XNOR: inverts XOR; 1 when the inputs match.

We use rectangular IEC-style symbols. The small output circle means inversion, not a connection. An arrow marks the active truth-table row as well as background color. Each button announces its state through both text and its accessible state.

A bit is not a universal voltage

0 and 1 are ideal logic states, not necessarily 0 V and 5 V. Thresholds depend on the logic family and supply voltage. This tool does not model floating inputs, propagation delays, contact bounce or undefined states.

NOT uses only A and has two rows. The other six gates use exactly two inputs and four rows. XOR means “exactly one” in this two-input case.

Common mistakes

  • Confusing OR with XOR when both inputs are on.
  • Applying the inversion bubble to one input when the diagram places it at the output.
  • Assuming a disconnected input is automatically 0 in a real circuit.

Try it yourself

When is NAND 0?

Only with A = 1 and B = 1. AND gives 1 and inversion turns it into 0.

Which gate detects matching inputs A and B?

XNOR gives 1 for 00 and 11, and 0 for 01 and 10.