Full Reference →

Qiskit Cheat Sheet

Install: pip install qiskit qiskit-aer qiskit-ibm-runtime

Background and History

Qiskit was created by IBM Research and first released as open-source software in March 2017, making it one of the earliest full-featured quantum computing SDKs available to the public. The name “Qiskit” is a portmanteau of “quantum information science kit.” IBM’s motivation was to provide a Python-based programming layer for its cloud-accessible quantum processors, which had become available through the IBM Quantum Experience (now IBM Quantum) platform in May 2016. Jay Gambetta, Ali Javadi-Abhari, and a team at IBM’s Thomas J. Watson Research Center led the initial development.

Qiskit was originally organized into four pillars: Terra (core circuits and transpilation), Aer (simulation), Ignis (error mitigation), and Aqua (algorithms). Over time, this structure was simplified. Ignis was deprecated in 2021, and Aqua was retired in 2022, with its functionality migrated to standalone application libraries (Qiskit Nature, Qiskit Optimization, Qiskit Machine Learning, Qiskit Finance). In September 2023, Qiskit reached version 0.45, and then IBM released Qiskit 1.0 in February 2024, marking a major API stabilization milestone. The 1.0 release consolidated the SDK into a single core package with a cleaner interface and committed to semantic versioning going forward.

Qiskit is the most widely adopted quantum programming framework by number of users and community contributions. As of 2025, the GitHub repository has accumulated over 13,000 stars and contributions from hundreds of developers worldwide. IBM uses Qiskit as the primary interface to its fleet of superconducting quantum processors, including the 1,121-qubit Condor chip and the utility-scale Heron processors. The Qiskit Runtime service provides optimized primitives (Sampler and Estimator) for running workloads on IBM hardware with built-in error mitigation. Qiskit also serves as a common compilation target for other tools, including pytket, Superstaq, and PennyLane through their respective Qiskit plugins.

Installation

pip install qiskit qiskit-aer qiskit-ibm-runtime

For visualization support:

pip install qiskit[visualization] matplotlib pylatexenc

Key Imports

from qiskit import QuantumCircuit, transpile
from qiskit_aer import AerSimulator
from qiskit_ibm_runtime import QiskitRuntimeService, SamplerV2

Core Classes

QuantumCircuit

The central object in Qiskit. Defines the sequence of quantum operations to apply.

qc = QuantumCircuit(2, 2)   # 2 qubits, 2 classical bits
qc = QuantumCircuit(3)       # 3 qubits, no measurement bits

Key methods:

MethodDescription
qc.h(qubit)Hadamard gate - puts qubit in superposition
qc.x(qubit)Pauli-X (NOT) gate
qc.y(qubit)Pauli-Y gate
qc.z(qubit)Pauli-Z gate
qc.cx(control, target)CNOT gate
qc.ccx(c1, c2, target)Toffoli (CCNOT) gate
qc.swap(q1, q2)SWAP gate
qc.s(qubit)S gate (√Z)
qc.t(qubit)T gate (fourth root of Z)
qc.rx(θ, qubit)Rotation around X-axis by θ radians
qc.ry(θ, qubit)Rotation around Y-axis by θ radians
qc.rz(θ, qubit)Rotation around Z-axis by θ radians
qc.measure(qubit, cbit)Measure qubit into classical bit
qc.measure_all()Measure all qubits
qc.barrier()Visual/logical separator in circuit
qc.reset(qubit)Reset qubit to
qc.compose(other)Append another circuit
qc.inverse()Return the inverse circuit
qc.draw()Print circuit diagram

transpile

Converts a circuit to a form runnable on a given backend - maps to native gates, optimises depth.

from qiskit import transpile

compiled = transpile(qc, backend)
compiled = transpile(qc, basis_gates=['cx', 'u'], optimization_level=3)

optimization_level ranges from 0 (none) to 3 (heavy).

AerSimulator

Local high-performance simulator. Supports statevector, stabilizer, density matrix, and noise models.

from qiskit_aer import AerSimulator

sim = AerSimulator()
sim = AerSimulator(method='statevector')
sim = AerSimulator(method='stabilizer')   # fast for Clifford circuits

result = sim.run(transpile(qc, sim), shots=1024).result()
counts = result.get_counts()
statevector = result.get_statevector()   # if no measurement

SamplerV2 (IBM Hardware)

The primitive for running circuits on real IBM Quantum backends.

from qiskit_ibm_runtime import QiskitRuntimeService, SamplerV2

service = QiskitRuntimeService()
backend = service.least_busy(operational=True, simulator=False)

sampler = SamplerV2(backend)
job = sampler.run([transpile(qc, backend)])
result = job.result()
counts = result[0].data.c.get_counts()

StatevectorSimulator (exact)

from qiskit.quantum_info import Statevector

sv = Statevector(qc)
print(sv)
print(sv.probabilities_dict())

Common Patterns

Bell state

qc = QuantumCircuit(2, 2)
qc.h(0)
qc.cx(0, 1)
qc.measure([0, 1], [0, 1])

Parameterised circuit

from qiskit.circuit import Parameter

theta = Parameter('θ')
qc = QuantumCircuit(1)
qc.ry(theta, 0)
bound = qc.assign_parameters({theta: 1.57})

Noise model

from qiskit_aer.noise import NoiseModel, depolarizing_error

noise = NoiseModel()
error = depolarizing_error(0.01, 1)
noise.add_all_qubit_quantum_error(error, ['h', 'x'])
sim = AerSimulator(noise_model=noise)

Circuit Visualisation

qc.draw('text')       # ASCII
qc.draw('mpl')        # matplotlib figure
qc.draw('latex')      # LaTeX
print(qc)             # shorthand for text