---
title: Save circuits to disk
description: Store Qiskit objects to disk so you can continue where you left off
source: https://quantum.cloud.ibm.com/docs/en/guides/save-circuits
---

# Save circuits to disk

### Package versions

The code on this page was developed using the following requirements.
We recommend using these versions or newer.

```
qiskit[all]~=2.5.2
```

Use [QPY serialization](/docs/api/qiskit/qpy) to save your circuit to file. QPY files store the full Qiskit circuit object and will be compatible with newer versions of Qiskit (although not necessarily with older versions of Qiskit).

To demonstrate, the following cell creates a simple quantum circuit.

```python
from qiskit import QuantumCircuit

qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)
qc.measure_all()
```

To save this file to disk, use the `qpy.dump` function. You can also save a list of circuits.

```python
from qiskit import qpy

with open("test.qpy", "wb") as file:
    qpy.dump(qc, file)
```

This circuit is now saved to the file `test.qpy`. If you restart your Python kernel, you can re-load the circuit using the `qpy.load` function. Note that this always returns a list of circuits, even if you only serialized one circuit.

```python
with open("test.qpy", "rb") as handle:
    qc = qpy.load(handle)

qc[0].draw("mpl")
```

Output:

![Output of the previous code cell](https://quantum.cloud.ibm.com/docs/images/guides/save-circuits/extracted-outputs/210d05c8-c9eb-4135-bb3f-94c281708f4b-0.svg)
