Controlled-Z gate

Flips the sign of |11⟩ only. Symmetric: it does not matter which qubit is the control.

Entangling · 2 qubits · reviewed November 2026

Matrix

[ 1 0 0  0 ]
[ 0 1 0  0 ]
[ 0 0 1  0 ]
[ 0 0 0 −1 ]

What it does

|11⟩→−|11⟩
|++⟩→(|00⟩ + |01⟩ + |10⟩ − |11⟩)/2

In plain words

CZ adds a phase of −1 to the one basis state where both qubits are 1. Because of that symmetry, many superconducting devices use CZ as their native gate. It is also the oracle in the two-qubit Grover example.

Identities

  • CZ = (I⊗H)·CX·(I⊗H)
  • CZ·CZ = I

Where it is used

  • Native gate on some hardware
  • Oracles in Grover search
  • Cluster states

Code

# Qiskit
qc.cz(0, 1)

// OpenQASM 2.0
cz 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

Is CZ different from CNOT?

They are equivalent up to Hadamards on the target. Which one is native depends on the hardware.

Try the CZ gate in the Circuit Builder →