Big-endian encoding maps a bit string to an integer with the most significant bit first and the least significant bit last. Thus, two-qubit state |01⟩ maps to 1 in big-endian notation, while the same written string maps to 2 in little-endian notation. The choice matters whenever basis states, state-vector amplitudes, measurement strings, or matrix rows and columns are indexed by integers. section 2.3 section 3.5.1
Endianness is a representation convention, not a universal quantum-computing rule. Q# uses big-endian notation for qubit-register interpretation, whereas Qiskit uses little-endian notation internally; Qiskit measurement output reverses the displayed order into a big-endian bit string. Name qubits by least- and most-significant roles rather than by left/right position to keep the mapping explicit. section 2.3 section 4.1.2
Use big-endian consistently when translating between representations:
- Read a register as most-significant bit through least-significant bit when assigning integer meanings to basis states or amplitude-array positions. section 2.3
- Account for row and column bit ordering before deriving a controlled-gate matrix, since the integer-to-basis-state mapping changes its block structure. section 3.5.1
- Reverse a Q# qubit array when an API interprets an integer control pattern little-endian but the register convention is big-endian. section 3.9.3
- Convert Qiskit measurement keys with standard binary parsing only after recognizing that their displayed order is big-endian. section 4.1.2
Reconciling a Q# control pattern
A Q# register stores its most significant qubit first, but ApplyControlledOnInt converts its integer argument into a little-endian control-pattern bit string. For a controlled operation using pattern k, reverse the relevant qubit slice before passing it as controls. This changes only the array-variable order, not the quantum state or applied gates. section 3.9.3
Listing 3.19 Q# code to implement an arbitrary CS unitary
import Std.Arrays.*;
operation ApplyArbitraryCSMatrix(
qs : Qubit[],
cs : (Double, Double)[] #1
) : Unit is Adj + Ctl {
for (k, (c, s)) in Enumerated(cs) {
let m = [[c, -s], [s, c]];
ApplyControlledOnInt(k, ApplyOneQubit,
Reversed(qs[1...]), ([qs[0]], m));
}
}
Inspect the reversed control-register slice used to reconcile Q# register ordering with ApplyControlledOnInt control-pattern ordering. section 3.9.3
Big-endian also labels phase-estimation output: with two control qubits, the first qubit stores the most significant estimated eigenphase bit before measurement. section 5.3.5

