# OpenQASM **OpenQASM** (Open Quantum Assembly Language) is a low-level instruction format for quantum circuits. It's a text language that describes qubit operations, gates, measurements, and control flow. Qiskit can convert circuits to OpenQASM and back. OpenQASM is useful for circuit exchange, archival, and low-level circuit inspection. ## OpenQASM Syntax ```qasm // Bell state circuit in OpenQASM OPENQASM 2.0; include "qelib1.inc"; qreg q[2]; creg c[2]; h q[0]; cx q[0], q[1]; measure q[0] -> c[0]; measure q[1] -> c[1]; ``` Each line is an operation: - `h q[0]` — Hadamard on qubit 0 - `cx q[0], q[1]` — CNOT from 0 to 1 - `measure q[i] -> c[i]` — measure qubit i into classical bit i ## Qiskit Integration Convert Qiskit circuits to OpenQASM: ```python from qiskit import QuantumCircuit qc = QuantumCircuit(2, 2) qc.h(0) qc.cx(0, 1) qc.measure([0, 1], [0, 1]) # Export to OpenQASM qasm_str = qc.qasm() print(qasm_str) # Import from OpenQASM qc2 = QuantumCircuit.from_qasm_str(qasm_str) ``` OpenQASM is a standard format across quantum platforms (IBM, Rigetti, IonQ). Qiskit 0.43+ supports OpenQASM 3.0, which adds more features (loops, conditionals, functions). OpenQASM is mainly useful for interoperability and archival; most Qiskit users work with Python.