When creating multi-bit quantum and classical registers, what is the ordering of MSB to LSB? For instance, I created a quantum register via

import qiskit
qr = qiskit.QuantumRegister(2, name='qr')

Is qr[1] the MSB, or is it qr[0]?

For an example of why I'm asking, please review the following:

import qiskit
qr = qiskit.QuantumRegister(2, name='qr')
cr = qiskit.ClassicalRegister(2, name='cr')
qc = qiskit.QuantumCircuit(qr, cr)

# Result should be Bell state (|00>+|11>)/sqrt(2)
qc.cx(qreg[0], qreg[1])

# Result should be state |00>
qc.cx(qreg[0], qreg[1])

# Result should be state |10>

qc.measure(qreg, creg)

quantum circuit

At the end here I expect the quantum register to be in the state |10>, but the histogram below shows the state |01>. This indicates to me the MSB is the right-most bit, but I don't understand why the authors would do that. Is there some fundamental misunderstanding in my approach?

EDIT: Also the example is a bit convoluted--I initialized a Bell state because that's what the input to my circuit will be, but the same result happens with just the NOT gate on qr[0].

enter image description here


1 Answer 1


Pulling from another question (Big Endian vs. Little Endian in Qiskit) and their documentation (https://qiskit.org/textbook/ch-appendix/qiskit.html), it appears that the register is intentionally labeled right-to-left so that integers are intuitively represented. Consider your example, where you applied X(qr[0]):

$ |00\rangle \rightarrow |01\rangle $, which is "1" as an integer. $1 = 2^0$

There example used X(qr[7]) on an 8 qubit register:

$ |00000000\rangle \rightarrow |10000000\rangle = 32 = 2^7 $

  • $\begingroup$ Thank you! I was having trouble locating the documentation for that bit of information, so these will be useful references. $\endgroup$
    – Stephen B
    Sep 27, 2019 at 8:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.