Sample QASM Files

Looking to try some circuits but don't have time to write them yourself? Grab one of these and give it a shot. Each file is small enough to run on today's quantum computers.

OpenQASM Official Examples

OpenQASM is the open-source quantum assembly language originally developed at IBM Research and now maintained as a community standard. It is the most widely adopted language for describing quantum circuits, supported by virtually every major quantum computing platform. These example files come from the official specification repository and demonstrate fundamental quantum algorithms.

Cross, A. W. et al. “Open Quantum Assembly Language.” arXiv:1707.03429. Licensed under Apache 2.0.

IBM

Quantum Teleportation

teleport.qasm

Transfers a quantum state from one qubit to another using entanglement and classical communication. One of the most famous protocols in quantum information.

3 qubits~7 gates

Quantum Fourier Transform

qft.qasm

The quantum analog of the discrete Fourier transform. A key building block in many quantum algorithms including Shor's factoring algorithm.

4 qubits~12 gates

Quantum Error Correction

qec.qasm

Detects and corrects single bit-flip errors using a 3-qubit repetition code with 2 ancilla qubits for syndrome measurement. A foundational technique for fault-tolerant quantum computing.

5 qubits~8 gates

W-State Preparation

W-state.qasm

Prepares the 3-qubit W state (|001⟩ + |010⟩ + |100⟩)/√3 — an entangled state that retains entanglement even if one qubit is lost, unlike GHZ states.

3 qubits~6 gates

QASMBench

QASMBench is a peer-reviewed benchmark suite created by Pacific Northwest National Laboratory (PNNL), one of the U.S. Department of Energy’s premier research institutions. The suite contains hundreds of quantum circuits spanning chemistry, optimization, machine learning, and cryptography — organized by qubit count so you can find circuits that match your target hardware. We’ve selected a handful of small circuits from the pnnl/QASMBench repository that are ideal for getting started.

Li, A. et al. “QASMBench: A Low-Level Quantum Benchmark Suite for NISQ Evaluation and Simulation.” ACM TQCI, 2023. Licensed under BSD 3-Clause.

Pacific Northwest National Laboratory

Deutsch's Algorithm

deutsch_n2.qasm

The simplest quantum algorithm ever devised. Determines whether a function is constant or balanced with a single query — the original proof that quantum computers can outperform classical ones.

2 qubits~5 gates

Cat State (GHZ) Preparation

cat_state_n4.qasm

Creates the maximally entangled "cat state" (|0000⟩ + |1111⟩)/√2 using just one Hadamard and a chain of CNOTs. A clean, minimal demonstration of multi-qubit entanglement.

4 qubits~4 gates

Grover's Search

grover_n2.qasm

Finds a marked item in an unsorted database of 4 elements with a single query. Demonstrates the quadratic speedup that makes quantum search powerful at scale.

2 qubits~14 gates

Quantum Teleportation

teleportation_n3.qasm

Another implementation of quantum teleportation — transfers a quantum state across qubits using a shared Bell pair and classical communication.

3 qubits~7 gates

Bell State Preparation

bell_n4.qasm

Prepares entangled Bell pairs across 4 qubits. Bell states are the simplest examples of quantum entanglement and form the basis for teleportation and superdense coding.

4 qubits~15 gates

Simon's Algorithm

simon_n6.qasm

Finds a hidden period in a black-box function exponentially faster than any classical algorithm. This idea directly inspired Shor's factoring algorithm.

6 qubits~16 gates

QAOA

qaoa_n3.qasm

A hybrid quantum-classical approach to solving combinatorial optimization problems. Alternates between problem-specific and mixing layers to approximate optimal solutions.

3 qubits~13 gates

Quantum Fourier Transform

qft_n4.qasm

Transforms computational basis states into frequency basis using Hadamard and controlled-phase rotation gates. Fundamental to quantum phase estimation and factoring.

4 qubits~12 gates
Sample QASM Circuits | Open Quantum