circuits / toffoli-gate

Toffoli Gate (CCNOT)

FEATURED

The Toffoli gate (CCNOT) flips the target qubit only when both control qubits are |1⟩. Fundamental for reversible computing.

quantumcomputer.dev
openqasm3q3 gatesdepth 20 views0 saves0 forks0 downloads

Source Code

OPENQASM 2.0;
include "qelib1.inc";
qreg q[3];
creg c[3];
// Set controls to |1>
x q[0]; x q[1];
// Toffoli
ccx q[0],q[1],q[2];
measure q -> c;

Cite this circuit

MIT
quantumcomputer.dev. "Toffoli Gate (CCNOT)". quantumcomputer.dev/circuits/toffoli-gate. 2026.