Superdense Coding

Updated: 28/10/2025

Interested in learning how to program quantum computers? Then check out our Qiskit textbook Introduction to Quantum Computing with Qiskit.

What is Superdense coding ?

Superdense coding is a quantum communications protocol that allows a user to send two classical bits by sending only one qubit.

The protocol

Circuit diagram showing the Superdense coding protocol

Circuit diagram showing the Superdense coding protocol

Step 1: Preparing the Bell pair

First a bell pair consisting of two qubits is prepared. Where q0 is the senders qubit and q1 is the receivers qubit. To do this q0 is put in to a superposition of states using a Hadamard gate.

Then a CNOT operation is performed with q0 being the control and q1 being the target.

Step 2: Encode the information on to q0

Next the sender has to encode the information they want to send on to q0 by applying certain operations to it.

  • If they want to send 00 then they perform no operation.

  • If they want to send 01 then they perform a Pauli-Z operation where q1s state is flipped.

  • If they want to send 10 then they apply a Pauli-X gate.

  • If they want to send 11 then apply a Pauli-Z gate followed by a Pauli-X gate

Step 3: Receiver decodes the information

Next q0 is sent and the receiver has to decode the qubit. This is done by applying a CNOT where the received q0 is the control and q1 is the target. Then a Hadamard gate is applied to q0.

Code

from qiskit import QuantumCircuit, transpile, ClassicalRegister, QuantumRegister
from qiskit_aer import AerSimulator

def executeCircuit(circuit, backend, shots=1024):

    result = backend.run(circuit,shots=shots).result()
    counts = result.get_counts(circuit)
    print('RESULT: ',counts) # Print result 


backend = AerSimulator() # Using local Aer simulator  

q = QuantumRegister(2,'q') 
c = ClassicalRegister(2,'c')  

#################### 00 ########################### 
circuit = QuantumCircuit(q,c)  
circuit.h(q[0]) # Hadamard gate applied to q0 
circuit.cx(q[0],q[1]) # CNOT gate applied 
circuit.cx(q[0],q[1])  
circuit.h(q[0])    
circuit.measure(q,c) # Qubits measured 

executeCircuit(circuit, backend, shots=10)                                 

#################### 10 ########################### 
circuit = QuantumCircuit(q,c)   
circuit.h(q[0]) 
circuit.cx(q[0],q[1]) 
circuit.x(q[0]) # X-gate applied 
circuit.cx(q[0],q[1]) 
circuit.h(q[0])  
circuit.measure(q,c)  

executeCircuit(circuit, backend, shots=10)

#################### 01 ########################### 
circuit = QuantumCircuit(q,c)   
circuit.h(q[0]) 
circuit.cx(q[0],q[1]) 
circuit.z(q[0]) # Z-gate applied to q0  
circuit.cx(q[0],q[1]) 
circuit.h(q[0])  
circuit.measure(q,c)        

executeCircuit(circuit, backend, shots=10)   

#################### 11 ########################### 
circuit = QuantumCircuit(q,c)   
circuit.h(q[0]) 
circuit.cx(q[0],q[1]) 
circuit.z(q[0]) # Z-gate applied  
circuit.x(q[0]) # X-gate applied  
circuit.cx(q[0],q[1]) 
circuit.h(q[0])  
circuit.measure(q,c)  

executeCircuit(circuit, backend, shots=10)