CNOT gate (controlled-X)
Flips the target qubit only when the control qubit is 1. With a Hadamard it creates entanglement.
Entangling · 2 qubits · reviewed November 2026
Matrix
[ 1 0 0 0 ] [ 0 1 0 0 ] [ 0 0 0 1 ] [ 0 0 1 0 ]
What it does
| |00⟩ | → | |00⟩ |
| |10⟩ | → | |11⟩ |
| |+0⟩ | → | (|00⟩ + |11⟩)/√2 |
In plain words
CNOT is the workhorse two-qubit gate. On basis states it is a classical XOR: the target becomes control XOR target. On superpositions it creates entanglement.
Together with single-qubit gates, CNOT is universal for quantum computing. Many hardware platforms implement a CNOT or an equivalent such as CZ or iSWAP natively, so counting two-qubit gates is a good way to estimate error.
Identities
- CX·CX = I
- CX with H on both sides of the target = CZ
- Three alternating CX gates = SWAP
Where it is used
- Creating Bell and GHZ states
- Parity checks in error correction
- Oracles
Code
# Qiskit qc.cx(0, 1) // OpenQASM 2.0 cx q[0],q[1];
Qiskit prints qubit 0 on the right of a bitstring. The builder prints it on the left.
See it in an example
Related gates
Questions
In this builder, which click is the control?
The first qubit you click is the control and the second is the target, both in the same column.