# QuantumCircuit.reverse_bits¶

QuantumCircuit.reverse_bits()[source]

Return a circuit with the opposite order of wires.

The circuit is “vertically” flipped. If a circuit is defined over multiple registers, the resulting circuit will have the same registers but with their order flipped.

This method is useful for converting a circuit written in little-endian convention to the big-endian equivalent, and vice versa.

Returns

the circuit with reversed bit order.

Return type

QuantumCircuit

Examples

input:

┌───┐

q_0: ┤ H ├─────■──────

└───┘┌────┴─────┐

q_1: ─────┤ RX(1.57) ├

└──────────┘

output:

┌──────────┐

q_0: ─────┤ RX(1.57) ├

┌───┐└────┬─────┘

q_1: ┤ H ├─────■──────

└───┘