Pauli-Z gate (phase flip)

Leaves |0⟩ alone and multiplies |1⟩ by −1. Probabilities do not change, but interference does.

Phase flip · 1 qubit · reviewed November 2026

Matrix

[ 1   0 ]
[ 0  −1 ]

What it does

|0⟩→|0⟩
|1⟩→−|1⟩
|+⟩→|−⟩

In plain words

Z has no visible effect on a basis state, which is why it can seem useless at first. Its power is on superpositions: it turns the plus state into the minus state, and those two are fully distinguishable after a Hadamard.

Identities

  • Z·Z = I
  • Z = H·X·H
  • Z = S·S
  • Z = RZ(π) up to a global phase

Where it is used

  • Phase kickback in oracles
  • Marking a state in Grover’s algorithm
  • Correcting phase errors in teleportation

Code

# Qiskit
qc.z(0)

// OpenQASM 2.0
z q[0];

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

If Z changes no probabilities, why does it matter?

Because a later Hadamard turns the changed phase into a changed probability. The H–Z–H example in the builder shows it.

Try the Z gate in the Circuit Builder →