Create your first quantum circuit

You can use Circuit Composer to build and run a complete quantum circuit. For your “Hello world” circuit, you will create a Bell state.

The visualizations at the bottom of the page will automatically update to reflect simulated results as you add operations to your circuit. However, if you would like the option to run your circuit on real quantum hardware or a simulator backend, or if you wish to visualize more than four qubits, you will need to sign in to IBM Quantum Experience by clicking the Sign in button in the upper right corner.

Step 1. Open Circuit Composer.

To open Circuit Composer, click on the circuit icon in the left-hand navigation bar.

Circuit icon in left navigation bar.

You will see a set of horizontal lines, or wires, that resemble a ruled piece of paper. The top wires are the qubits, and the bottom wire is a classical register.

Step 2. Add an H gate (Hadamard gate) to your circuit.

To add an H gate to your circuit, drag and drop the H operation from the palette of quantum operations to the top qubit, q[0].

Hadamard gate on q[0].

Step 3. Add a CX gate to your circuit.

To add a CX gate to your circuit, drag and drop the CX operation from the palette of quantum operations to the right of the H gate. This operation acts on two qubits.

CNOT gate added to circuit.

Step 4. Add a measurement operation.

To add a measurement to your circuit, drag and drop the measurement operation from the palette of quantum operations to the right of the CX operation.

measurement operation on circuit.

The measurement result is recorded as a classical bit on the classical register. The vertical wire connecting the measurement operation to the bottom wire depicts information flowing from the qubit down to the classical register.

You have now built your first quantum circuit. The visualization panels below your circuit give a simulated result that updates automatically as you add and remove operations.

To learn more about visualizations, review the Visualizations topic.

For instuctions to run this circuit on real quantum hardware, see Run circuits and view results.