Skip to content
ContentLora

    Tip: press / anywhere to search.

    Explainer

    Quantum gates and circuits explained: how quantum programs run

    A quantum program is a circuit: a sequence of gates, measurements and resets applied to qubits and run many times, one shot at a time, on a quantum processor.[1][2] A few gates go a long way: one-qubit gates plus the two-qubit CNOT can build any quantum operation, and compilers translate programs into the gates each machine supports.[3][4]

    Editor reviewedUpdated Explainer23 claims · 96% primaryQuantum computing, Computing
    Reading level: 3 passages differ; the rest is the same for everyone.

    Reading order: start with superposition and entanglement and how qubits work. This page comes next, followed by quantum algorithms.

    What a circuit is

    A quantum program is a circuit: a list of operations on qubits. IBM’s Qiskit documentation calls the circuit the fundamental element of quantum computing. It is made of gates, measurements and resets.[1] The same circuit is run many times. Each run is a “shot”, and software gathers the results into statistics.[2]

    A circuit acts on a fixed register of qubits with unitary gates, measurements and resets. It can also include real-time classical computation and control flow, which the processor’s controllers execute during a shot.[1][5] Google’s Cirq represents a circuit as an ordered series of moments, each a set of operations that act in the same time slice.[6] Results are estimated by gathering data from many shots.[2]

    Gates: rotations of a qubit

    A gate changes the state of one or more qubits. Most single-qubit gates can be pictured as turning the qubit’s state around an axis.[7] The most important one for beginners is the Hadamard gate. It takes a qubit that is definitely 0 or definitely 1 and turns it into an equal superposition of both, and it can turn it back again.[8] Superposition itself is explained on this page.[9]

    Most gates have a unitary matrix representation, although not every circuit operation is unitary.[10] Single-qubit gates are rotations; the S and T gates are the square root and fourth root of Z.[7] The Hadamard is a pi rotation about the X+Z axis that maps the computational basis to the plus/minus basis and back.[8]

    Two-qubit gates and entanglement

    The CNOT, or controlled-NOT, is the two-qubit exclusive-or gate. It flips a target qubit when the control qubit is 1.[3] A Hadamard followed by CNOTs is the textbook way to entangle qubits. Qiskit’s standard example uses this pattern to make a three-qubit GHZ state.[11] Cirq’s documentation shows the first half of quantum teleportation built from just a Hadamard, a CNOT and a measurement.[12] Entangled qubits have correlated states, so measuring one tells you something about the others.[13]

    A small set of gates can do everything

    Quantum hardware does not need a separate gate for every operation. A 1995 paper showed that all one-qubit gates plus the CNOT are “universal”: any operation on any number of qubits can be built from them.[3] Another 1995 result showed that gates acting on just two qubits at a time are enough in general.[14]

    A 1995 paper showed that U(2) plus CNOT generates U(2^n), and derived bounds on how many of these gates other gates need.[3] DiVincenzo proved two-qubit gates universal, improving on earlier three-qubit results.[14] For fault tolerance a finite gate set is needed. The Solovay-Kitaev algorithm compiles any single-qubit gate into an efficient sequence drawn from a fixed set such as Hadamard, CNOT and pi/8 (T).[15] No error-detecting code can do every gate in the simplest fault-tolerant (transversal) way, so gates such as T need extra resources, which is why magic states matter.[16][17]

    Which circuits are hard to simulate

    Having many qubits is not enough to make a circuit hard for classical computers. Under the Gottesman-Knill theorem, circuits made only of CNOT, Hadamard and phase gates (stabilizer circuits) can be simulated efficiently on an ordinary computer.[18] A 2004 simulator handled thousands of such qubits easily.[19] Adding a non-stabilizer ingredient, such as magic states for the T gate, restores universal quantum computation.[20] Interference between amplitudes, which IBM calls the engine of quantum computing, does the rest.[21]

    From abstract circuit to hardware

    Programmers usually write abstract circuits on virtual qubits. Software then converts them into physical circuits for a particular chip, a step Qiskit calls transpilation. It rewrites the circuit into the chip’s native “basis” gates and respects which qubits are physically connected.[4] Qubits lose their quantum state over time through decoherence.[22] Long circuits therefore need error correction, where many physical qubits are checked repeatedly to protect one logical qubit.[23] The software tools themselves are covered in quantum software and SDKs.

    Next in the crash course

    More in Quantum computing

    Developing in AI & Computing

    Questions readers ask

    What is a quantum gate?

    An operation applied to one or more qubits. Most gates can be written as a unitary matrix, and most single-qubit gates can be pictured as rotations around an axis.[10][7]

    What do the Hadamard and CNOT gates do?

    The Hadamard turns the basis states 0 and 1 into equal superpositions. The CNOT (controlled-NOT, or exclusive-or) flips a target qubit depending on a control qubit. Together they create entangled states such as the three-qubit GHZ state.[8][3][11]

    How many different gates does a quantum computer need?

    Very few. All one-qubit gates plus CNOT are universal, two-qubit gates are enough in general, and the Solovay-Kitaev algorithm approximates any single-qubit gate with a small fixed set.[3][14][15]

    Does a circuit with many qubits automatically beat a classical computer?

    No. Circuits built only from CNOT, Hadamard and phase gates can be simulated efficiently on a classical computer, and a 2004 simulator handled thousands of qubits.[18][19]

    Sources

    · 23 claims from 8 publishers

    Each numbered claim is a statement we checked against the sources listed with it. Tap a number in the text to see its sources in place.

    1. [1]

      IBM's Qiskit documentation calls the quantum circuit the fundamental element of quantum computing, a routine run one shot at a time on a quantum processor that acts on qubits with gates, measurements and resets. confirmedas of 2026-11-22

    2. [2]

      Software tools accumulate data from many shots, or repeated runs, of a circuit to turn quantum results into classical data and error statistics. confirmedas of 2026-11-22

    3. [3]

      A 1995 paper showed that all one-qubit gates plus the two-qubit exclusive-or (controlled-NOT) gate are universal, meaning any operation on any number of qubits can be built from them, and bounded the number of these gates needed to build other gates. confirmedas of 2026-11-22

    4. [4]

      Qiskit distinguishes abstract circuits written for virtual qubits from physical circuits written for real hardware qubits, and converts between them through transpilation, which respects the hardware's basis gates and connections. confirmedas of 2026-11-22

    5. [5]

      A quantum circuit can also contain operations on classical data, including real-time computations and control flow, which the quantum processor's controllers execute. confirmedas of 2026-11-22

    6. [6]

      Google's Cirq software represents a circuit as an ordered series of moments, each a set of operations that act during the same time slice. confirmedas of 2026-11-22

    7. [7]

      Most single-qubit gates can be thought of as rotations around an axis, and the S and T gates are the square root and fourth root of the Z gate. confirmedas of 2026-11-22

    8. [8]

      The Hadamard gate is a single-qubit gate, a pi rotation about the X+Z axis, that swaps the computational basis states 0 and 1 for the equal-superposition states plus and minus, and back again. confirmedas of 2026-11-22

    9. [9]

      A qubit can act like a classical bit, storing a zero or a one, but it can also exist in a weighted combination of both at once (superposition). confirmedas of 2026-10-10

    10. [10]

      Most quantum gates can be written as a unitary matrix, though not every operation in a circuit corresponds to unitary evolution. confirmedas of 2026-11-22

    11. [11]

      Qiskit's documentation gives as a standard example a three-qubit circuit that makes an entangled Greenberger-Horne-Zeilinger (GHZ) state. confirmedas of 2026-11-22

    12. [12]

      Cirq's documentation shows the first half of a quantum teleportation circuit built from three gates, a Hadamard, a controlled-NOT (CNOT) and a measurement. confirmedas of 2026-11-22

    13. [13]

      Entanglement is the ability of qubits to correlate their state with other qubits, so that measuring one tells you something about the others. confirmedas of 2026-10-10

    14. [14]

      A 1995 Physical Review A paper proved that gates acting on just two qubits at a time are enough to build a general quantum circuit, improving on an earlier three-qubit result. confirmedas of 2026-11-22

    15. [15]

      The Solovay-Kitaev algorithm compiles any single-qubit gate into an efficient sequence of gates from a fixed, finite set, such as the set of Hadamard, controlled-NOT and pi/8 gates used for fault tolerance. reportedas of 2026-11-22

    16. [16]

      A 2009 theorem showed that no quantum code able to detect an arbitrary error on a single physical qubit can have a universal set of transversal gates, the simplest fault-tolerant kind. confirmedas of 2026-11-22

    17. [17]

      The logical operations that are easy to perform on error-corrected qubits are often limited, so universal, classically hard circuits need special resource states known as magic states. confirmedas of 2026-11-22

    18. [18]

      Under the Gottesman-Knill theorem, a circuit made only of CNOT, Hadamard and phase gates (a stabilizer circuit) can be simulated efficiently on a classical computer. confirmedas of 2026-11-22

    19. [19]

      A 2004 stabilizer-circuit simulator, CHP, could handle thousands of qubits on a classical computer. confirmedas of 2026-11-22

    20. [20]

      Bravyi and Kitaev showed in 2005 that Clifford operations combined with the preparation of special "magic" states are enough for universal quantum computation. confirmedas of 2026-11-22

    21. [21]

      Interference, in which quantum amplitudes reinforce some outcomes and cancel others, is described by IBM as the engine of quantum computing. confirmedas of 2026-10-10

    22. [22]

      Decoherence is the process by which a quantum state collapses into a non-quantum state, through measurement or disturbance from the environment, causing qubits to fail. confirmedas of 2026-10-10

    23. [23]

      In the surface code, data qubits and measure qubits are interleaved on a square lattice; repeated measurements flag physical errors without disturbing the stored logical information. confirmedas of 2026-01-13

    Revision history (1)
    1. Page created.

    Created Nov 22, 2026. Last reviewed by an editor on Nov 22, 2026. Next scheduled review: Aug 16, 2027.

    Cite this page

    "Quantum gates and circuits explained: how quantum programs run." ContentLora, updated Nov 22, 2026. https://contentlora.com/explain/quantum-gates-and-circuits-explained

    Spotted an error? Suggest a correction or emailcorrections@contentlora.com.