How quantum gates work, in plain English
What quantum gates do to a qubit, why every one of them has to be reversible, and why gates are where most errors come from.
Terms in this lesson
What you’ll learn
- Describe what the X, Z and H gates do to a qubit.
- Explain why quantum gates must be reversible.
- Say why two-qubit gates matter most for error rates.
A quantum program is a sequence of steps called gates. This lesson looks at the gates themselves, and the next, How a quantum algorithm works, puts them together into whole algorithms. What does each one actually do, why are they so different from the logic gates in an ordinary chip, and what physically happens inside the machine when one runs? No maths is needed beyond a few small numbers.
Ordinary gates throw information away
Every ordinary computer is built from logic gates: tiny circuits that take one or two bits in and give one bit out. Three do most of the work:
| Gate | What it does | Can you work out the inputs from the output? |
|---|---|---|
| NOT | Turns 0 into 1 and 1 into 0 | Yes: just flip it back |
| AND | Gives 1 only if both inputs are 1 | No: an output of 0 could come from 00, 01 or 10 |
| OR | Gives 1 if either input is 1 | No: an output of 1 could come from 01, 10 or 11 |
An ordinary AND gate can turn different inputs into the same output, losing information about which input it received. Ideal quantum logic gates work differently. They change the qubits' state while preserving the quantum information, so the amplitudes can still interfere later, and another gate can undo the change. This is called reversibility. A quantum computer can also measure or reset qubits during a calculation, but those are different kinds of operations. Measurements produce ordinary results, and resets prepare qubits again.
One-qubit gates are turns of the globe
The superposition lesson pictured a qubit as a point on a globe: 0 at the North Pole, 1 at the South Pole, even blends around the equator, and phase as longitude. Every one-qubit gate is simply a turn of that globe. Turning a globe never loses anything, which is exactly why the gates are reversible: turn it back and you're where you started.
- X, the flip. Turns the globe so the poles swap places: 0 becomes 1 and 1 becomes 0. It's the quantum version of NOT. Applied to a blend, it swaps the two amplitudes.
- Z, the sign flip. Turns the globe half way around its north–south axis. The poles don't move, so a plain 0 or 1 is unchanged and the odds of any state stay the same. What changes is the phase: the amplitude on 1 becomes negative. It looks like it does nothing, but that sign is what lets amplitudes cancel later.
- H, the blend. Moves a pole down to the equator, turning a plain 0 or 1 into an even 50/50 blend. Applied again, it moves the blend back to the pole. That's the "apply it twice and you're back to 0" trick from the worked example in the superposition lesson.
- Smaller turns. Quantum gates can rotate a qubit's state by different angles, changing its measurement probabilities or its phase. You can explore how rotations affect measurement chances in Measure a qubit, and how phase changes interference in the Interference experiment.
Go deeper: kets and the Born rule (optional maths)
Physicists write a qubit's state with a bracket called a ket. |0⟩ is the North Pole and |1⟩ is the South Pole. Any other point on the globe is a blend of the two:
α|0⟩ + β|1⟩
α and β are the two amplitudes. The Born rule turns amplitudes into chances: measuring gives 0 with probability |α|² and 1 with probability |β|². The two chances must add up to 1, so |α|² + |β|² = 1.
One even blend on the equator is (|0⟩ + |1⟩)/√2. Each amplitude is 1/√2, about 0.71, and 0.71² ≈ 0.5, so it gives 0 half the time and 1 half the time. That is the √2 you see in quick answers that use this notation.
Latitude sets the odds. Longitude is the phase, which the ordinary north–south measurement can't see. The next box shows why phase still matters.
Go deeper: phase as arrows (optional maths)
An amplitude is more than a size. Picture it as an arrow: its length sets the chance (the chance is the length squared), and its direction is the phase. Two arrows of the same length give the same odds, whichever way they point.
Z, S and T turn the globe around its north–south axis. Written in the usual way, they leave the arrow on |0⟩ alone and turn only the arrow on |1⟩. Z turns it half way round, which multiplies it by −1. S turns it a quarter, and T an eighth. None of them changes any odds on its own.
Direction matters when arrows meet. When two routes lead to the same answer, their arrows are added head to tail. Pointing the same way, they reinforce; pointing opposite ways, they cancel. H is where routes meet:
- H sends |0⟩ to (|0⟩ + |1⟩)/√2 and |1⟩ to (|0⟩ − |1⟩)/√2.
- Apply H to (|0⟩ + |1⟩)/√2 and both halves contribute to each answer. On |0⟩ the two arrows point the same way and add up to 1. On |1⟩ they point opposite ways and cancel to 0. Result: |0⟩, every time.
- Start from (|0⟩ − |1⟩)/√2 instead, and the cancelling happens on |0⟩, so the result is |1⟩.
Only relative phase matters. Turning both arrows by the same amount changes nothing you could ever measure.
Now you try: X and Z on a blend optional
1. Finish the working. A qubit has an amplitude of 0.6 attached to 0 and 0.8 attached to 1, so the chances are 36% and 64%. Apply X: the two amplitudes swap, giving 0.8 on 0 and 0.6 on 1. The chances swap too: 64% and 36%. Your turn: go back to the starting qubit and apply Z instead. What are the two amplitudes now, and what are the chances?
Show answer 1
Z makes the amplitude on 1 negative: 0.6 on 0 and −0.8 on 1. Squaring hides the sign, (−0.8) × (−0.8) = 0.64, so the chances are still 36% and 64%. Only the phase has changed.
2. On your own. Apply Z a second time to your answer. What state do you get, and what does that tell you about undoing a Z gate?
Show answer 2
The amplitude on 1 changes sign again: −0.8 becomes +0.8. You're back to 0.6 on 0 and 0.8 on 1, the starting state. A second Z undoes the first, which is reversibility at work.
Two-qubit gates: where qubits interact
One-qubit gates can only ever change qubits one at a time. To do anything a classical computer couldn't easily copy, qubits have to act on each other. The workhorse is the controlled flip, often called CNOT. It has a control qubit and a target qubit, and flips the target only where the control is 1:
| Before (control, target) | After | What happened |
|---|---|---|
| 0, 0 | 0, 0 | Control is 0: nothing |
| 0, 1 | 0, 1 | Control is 0: nothing |
| 1, 0 | 1, 1 | Control is 1: target flipped |
| 1, 1 | 1, 0 | Control is 1: target flipped |
On plain bits that's ordinary logic. The interesting case is when the control is a blend. Then the gate does both rows at once, each with its own amplitude, and the two qubits end up tied together. That's how entanglement is made, step by step, in Entanglement.
A close cousin, the controlled sign flip (CZ), makes an amplitude negative only where both qubits are 1. It's how Grover's search marks the right answer in How a quantum algorithm works.
Go deeper: gates as tables, and two-qubit notation (optional maths)
A gate can be written as a table of numbers called a matrix. Each column belongs to one input, and reading down it gives the amplitudes that input turns into. The table below shows the same information written as kets.
| Gate | Input |0⟩ becomes | Input |1⟩ becomes |
|---|---|---|
| X (flip) | |1⟩ | |0⟩ |
| Z (sign flip) | |0⟩ | −|1⟩ |
| H (blend) | (|0⟩ + |1⟩)/√2 | (|0⟩ − |1⟩)/√2 |
Gates in a row combine by applying one table after another, so a whole circuit, up to the point where it is measured, reduces to a single table. Because every gate is reversible, every table can be undone.
Two qubits. |10⟩ means "first qubit 1, second qubit 0". A two-qubit state has four amplitudes, one each for |00⟩, |01⟩, |10⟩ and |11⟩; n qubits have 2ⁿ. (This site writes the first qubit on the left. Qiskit numbers from the right, as the code example in How a quantum algorithm works notes.)
- Controlled flip (CNOT), first qubit as control: swaps the amplitudes on |10⟩ and |11⟩ and leaves the rest alone. That is the four-row table above, written in kets.
- Controlled sign flip (CZ): multiplies the amplitude on |11⟩ by −1 and leaves the rest alone.
Making a Bell state. Start at |00⟩. H on the first qubit gives (|00⟩ + |10⟩)/√2. The controlled flip then turns |10⟩ into |11⟩, giving (|00⟩ + |11⟩)/√2. This state can't be split into "a state of the first qubit" times "a state of the second". That is what entangled means in the notation.
Now you try: a controlled flip on a blend optional
1. Finish the working. The control qubit is an even blend and the target is a plain 0. Writing the control first, the pair has an amplitude of 0.71 on 00 and 0.71 on 10. The controlled flip handles each of those separately, using the rows of the table above. The 00 part: the control is 0, so nothing happens. It stays 00, with amplitude 0.71. Your turn: what happens to the 10 part? Then write down the whole state after the gate, and the chance of each of the four possible results.
Show answer 1
The control is 1, so the target flips: 10 becomes 11, still with amplitude 0.71. After the gate the pair has 0.71 on 00 and 0.71 on 11. Measured, it reads 00 half the time and 11 half the time, and never 01 or 10. The two qubits are now entangled.
2. On your own. Apply the same controlled flip again to your answer. What state do you get?
Show answer 2
The 00 part is unchanged. The 11 part has control 1, so its target flips back: 11 becomes 10. The pair is back to 0.71 on 00 and 0.71 on 10: a blended control beside a plain 0 target, no longer entangled. A second controlled flip undoes the first.
A small set builds everything
There are endless possible gates, but you don't need them all. A handful is enough to build any quantum calculation, to whatever accuracy is needed, in the same way a small box of Lego bricks can build almost anything. One well-known set is just H, the controlled flip and a small turn called T (an eighth of a full turn around the north–south axis).
That has a practical consequence. Each quantum machine offers its own small set of native gates, the ones its hardware does directly. Software called a compiler translates a program written in friendly gates into the machine's native ones, much as ordinary compilers turn code into a processor's instructions. It's one reason the same program can run on very different hardware.
What a gate physically is
An ordinary logic gate is a fixed piece of circuitry that signals flow through. A quantum gate isn't a part at all. It's an action: a precisely shaped pulse of energy aimed at the qubits.
- Superconducting qubits, used by IBM and Google, are turned by microwave pulses sent down wires into the refrigerator. A one-qubit gate takes a few tens of billionths of a second.
- Trapped ions are turned by laser pulses, or in some designs by microwaves. Their gates are slower, typically microseconds or more, but the qubits hold their state much longer.
- Two-qubit gates need the qubits to interact for a short, carefully controlled moment, through a shared circuit element for superconducting chips or the ions' shared motion in a trap.
The size, shape and timing of each pulse decide how far the globe turns. A pulse that's slightly too long or too strong over- or under-turns the qubit, and that's where errors come from.
Why gates go wrong
Real gates are never perfect. A pulse that's a little off, a stray signal or a qubit losing its blend part-way through all leave the state slightly wrong. One-qubit gates on the best hardware are now right well over 99.9% of the time. Two-qubit gates are harder, because two delicate qubits have to interact precisely while staying isolated from everything else; the best reach around 99.9%, and many machines are below that.
That's why the two-qubit error rate is usually the number to look for in a company's announcement, and why long algorithms need the error correction described in Why qubits are so fragile. A useful run of Shor's algorithm needs billions of gates; at one error per thousand, the answer would be lost long before the end.
Common questions
Is a quantum gate like a transistor? No. A transistor is a physical switch built into the chip. A quantum gate is an operation, a pulse applied to qubits that stay where they are. The same qubit can receive thousands of different gates during one program.
Why not just copy the qubit before a risky gate, as a backup? Quantum physics forbids making an exact copy of an unknown qubit state, the no-cloning rule. That's why error correction has to work differently, by spreading information across many qubits.
Is measurement a gate? Usually not. Every gate can be undone; measurement can't, because it ends the blend and gives one answer. Programs treat measurement as a separate operation, usually at the end, but sometimes part-way through a calculation.
What you’ve learned
- Ideal quantum logic gates are reversible: another gate can undo their effect. Measurements and resets work differently and can also happen during a calculation.
- Two-qubit gates such as the controlled flip are where qubits interact and entanglement is made.
- A gate is a precisely timed pulse, and small errors in each one are why error correction matters.
Check your understanding optional
An ordinary AND gate takes two bits and gives one. Why can't a quantum computer use it unchanged?
Show the answer
Because it throws information away: an output of 0 could have come from 00, 01 or 10, so the inputs can't be recovered. Quantum gates must be reversible so the amplitudes survive intact until they interfere. Ideal quantum logic gates are reversible, while measurements and resets are different operations that need not be reversible.
Sources and further reading
Tags show the kind of source (how sources are chosen and checked). Dates and figures were checked against these sources on 14 October 2026.
- BookQuantum Computation and Quantum Information (10th anniversary edition)Michael Nielsen and Isaac Chuang, Cambridge University Press, 2010
- Peer-reviewed paperElementary gates for quantum computationBarenco et al., Physical Review A, 1995
- ExperimentQuantum error correction below the surface code thresholdGoogle Quantum AI and collaborators, Nature, 2024
- Company announcementQuantinuum announces commercial launch of Helios (48 error-corrected logical qubits; 94-qubit entangled state)Quantinuum press release, 2025
Written by Muhammad Atif · Reviewed 26 November 2026 · Report a correction