An open source framework for programming quantum computers

Cirq is a Python software library for writing, manipulating, and optimizing quantum circuits, and then running them on quantum computers and quantum simulators. Cirq provides useful abstractions for dealing with today’s noisy intermediate-scale quantum computers, where details of the hardware are vital to achieving state-of-the-art results.

import cirq

# Pick a qubit.
qubit = cirq.GridQubit(0, 0)

# Create a circuit
circuit = cirq.Circuit(
    cirq.X(qubit)**0.5,  # Square root of NOT.
    cirq.measure(qubit, key='m')  # Measurement.

# Simulate the circuit several times.
simulator = cirq.Simulator()
result =, repetitions=20)



Learn how to build quantum circuits from gates acting on qubits. Understand what a Moment is and how different insertion strategies can help you build your desired circuit. Learn about how to slice and dice circuits and transform them into new and better circuits.
Learn more


Hardware constraints have a large impact on whether a circuit is practical or not on modern hardware. Learn how devices can be defined to handle these constraints, including how to program Google’s Quantum Computing Service.


Cirq comes with built-in simulators, both for wave functions and for density matrices. These can handle noisy quantum channels using monte carlo or full density matrix simulations. In addition, Cirq works with a state-of-the-art wavefunction simulator: qsim.

End-2-end experiments

Cirq works with our Quantum Computing Service to run experiments on Google’s quantum processors. Learn more about the latest experiments and access the code to see how to run them yourself.
Learn more

For beginners:

Zero to quantum circuit simulation

Get started on Cirq’s basics with this tutorial. Learn the difference between gates and operations and how to build circuits out of moments. Simulate the resulting quantum circuits and find out how to perform transformations on these circuits.

For advanced users:

Quantum approximate optimization algorithm

Learn how to write a quantum approximate optimization algorithm for NISQ hardware by writing a variational algorithm to optimize a solution to max-cut, which is a hard problem for classical computing.


Technical questions: Stack Exchange

GitHub repositories: Quantumlib

Educational resources


We are dedicated to cultivating an open and inclusive community to build software for near term quantum computers, and we welcome contributions from the community.

Join our weekly open source meetings

We host virtual open source meetings every week. Join our email lists to get invited to the ongoing open source meetings relevant to your work.

Cirq Weekly Sync

Subscribe: cirq-dev

OpenFermion Weekly Sync

Subscribe: openfermion-dev

TensorFlow Quantum Weekly Sync

Subscribe: tfq-dev

Quantum Circuit Simulation Weekly Sync

Subscribe: qsim-qsimh-dev

Contribute to open source code

Whether you are a researcher who wants to push the boundaries of what's available for NISQ computers, a software engineer, a technical writer, or a student who is excited about quantum computing, we welcome your contributions to our open source code available on GitHub.

Getting started

If you are looking for something to help out in Cirq, see the list of good first issues to get started.

Request for comment

For larger features, check out our RFC process to learn how to contribute.