ℹ️ Skipped - page is already crawled
| Filter | Status | Condition | Details |
|---|---|---|---|
| HTTP status | PASS | download_http_code = 200 | HTTP 200 |
| Age cutoff | PASS | download_stamp > now() - 6 MONTH | 0.2 months ago (distributed domain, exempt) |
| History drop | PASS | isNull(history_drop_reason) | No drop reason |
| Spam/ban | PASS | fh_dont_index != 1 AND ml_spam_score = 0 | ml_spam_score=0 |
| Canonical | PASS | meta_canonical IS NULL OR = '' OR = src_unparsed | Not set |
| Property | Value |
|---|---|
| URL | https://learn.microsoft.com/en-us/azure/quantum/concepts-error-correction |
| Last Crawled | 2026-04-05 17:48:25 (6 days ago) |
| First Indexed | 2024-06-15 22:54:01 (1 year ago) |
| HTTP Status Code | 200 |
| Meta Title | Quantum Error Correction Codes - Azure Quantum | Microsoft Learn |
| Meta Description | Learn how quantum error correction works, the types of quantum errors and codes, and how to correct errors using the three-qubit code as an example. |
| Meta Canonical | null |
| Boilerpipe Text | This article explains the basics of quantum error correction, the types of quantum errors, and some common quantum error correction codes. It also provides an example of how to correct errors using the three-qubit code.
Quantum error correction (QEC) is a technique that allows us to protect quantum information from errors. Error correction is especially important in quantum computers, because efficient quantum algorithms make use of large-scale quantum computers, which are sensitive to noise.
The basic principle behind quantum error correction is that the number of bits used to encode a given amount of information is increased. This redundancy allows the code to detect and correct errors.
The error rates for quantum computers are typically higher than classical computer's errors due to the challenges associated with building and operating quantum systems. Noise, decoherence, and imperfections in quantum gates can cause errors in quantum computations. Current quantum computers have error rates in the range of 1% to 0.1%. In other words, this means that on average one out of every 100 to 1000 quantum gate operations results in an error.
There are two fundamental types of quantum errors: bit flips and phase flips.
Bit flip errors occur when a qubit changes from
|
0
⟩
to
|
1
⟩
or vice versa. Bit flip errors are also known as
σ
x
-errors, because they map the qubit states
σ
x
|
0
⟩
=
|
1
⟩
and
σ
x
|
1
⟩
=
|
0
⟩
. This error is analogous to a classical bit flip error.
Phase flip errors occur when a qubit changes its phase. They are also known as
σ
z
-errors, because they map the qubit states
σ
z
|
0
⟩
=
|
0
⟩
and
σ
z
|
1
⟩
=
−
|
1
⟩
. This type of error has no classical analog.
In quantum computing, quantum errors can manifest as bit flips, phase flips, or a combination of both.
Quantum error correction codes work by encoding the quantum information into a larger set of qubits, called the
physical qubits
. The joint state of the physical qubits represents a
logical qubit
.
The physical qubits are subject to errors due to decoherence and imperfections in quantum gates. The code is designed so that errors can be detected and corrected by measuring some of the qubits in the code.
For example, imagine you want to send the single-qubit message
|
0
⟩
. You could use three physical qubits to encode the message, sending
|
000
⟩
, which is known as a
codeword
. This error-correcting code is a
repetition code
, because the message is repeated three times.
Now, imagine that a single bit-flip error occurs during transmission so that what the recipient receives is the state
|
010
⟩
. In this scenario, the recipient may be able to infer that the intended message is
|
000
⟩
. However, if the message is subject to two bit-flip errors, the recipient may infer an incorrect message. Finally, if all three bits are flipped so that the original message
|
000
⟩
becomes
|
111
⟩
, the recipient has no way of knowing an error occurred.
The code distance of a QEC code is the minimum number of errors that change one codeword into another, that is, the number of errors that can't be detected. The code distance
d
can be defined as
d
=
2
t
+
1
where
t
is the number of errors the code can correct. For example, the three-bit code can detect and correct one bit-flip error, so
t
=
1
, and thus the code distance is
d
=
3
.
Note that repetition codes, such as the three-bit code used in this example, can only correct bit-flip errors, and not phase flip errors. To correct both types of errors, more sophisticated quantum error correction codes are needed.
There are many different types of QEC codes, each with its own properties and advantages. Some common QEC codes are:
Repetition code:
The simplest quantum error correction code, where a single qubit is encoded into multiple qubits by repeating it multiple times. The repetition code can correct bit flip errors, but not phase flip errors.
Shor code:
The first quantum error correction code, developed by Peter Shor. It encodes one logical qubit into nine physical qubits. Shor code can correct one-bit flip error or one phase flip error, but it can't correct both types of errors at the same time.
Steane code:
This is a seven-qubit code that can correct both bit flip and phase flip errors. It has the advantage of being fault-tolerant, meaning that the error correction process itself doesn't introduce extra errors.
Surface code:
This is a topological error correction code that uses a two-dimensional lattice of qubits to encode logical qubits. It has a high error correction threshold and is considered one of the most promising techniques for large-scale, fault-tolerant quantum computing. The surface code is used by the
Microsoft Quantum resource estimator
.
Hastings-Haah code:
This quantum error correction code offers better space-time costs than surface codes on Majorana qubits in many regimes. For gate-based instruction sets, the overhead is larger, which makes this approach less efficient than the surface code.
The three-qubit error correction code is a simple repetition code that can detect and correct one bit flip error. It encodes a single logical qubit into three physical qubits by repeating the qubit three times.
Imagine you want to send an arbitrary single qubit
|
ϕ
⟩
=
α
|
0
⟩
+
β
|
1
⟩
. To avoid errors, you encode the basis states
|
0
⟩
and
|
1
⟩
into a joint state of three qubits. The two logical basis states are
|
0
L
⟩
=
|
000
⟩
and
|
1
L
⟩
=
|
111
⟩
.
Therefore, the single qubit
|
ϕ
⟩
=
α
|
0
⟩
+
β
|
1
⟩
is encoded as:
|
ϕ
L
⟩
=
α
|
000
⟩
+
β
|
111
⟩
=
α
|
0
L
⟩
+
β
|
1
L
⟩
Let's break down the steps of the three-qubit code.
First, you encode your single qubit
|
ϕ
⟩
=
α
|
0
⟩
+
β
|
1
⟩
into a joint state of three qubits.
Next, you prepare two further qubits in the state
|
0
⟩
. So, the global state of all three qubits is
(
α
|
0
⟩
+
β
|
1
⟩
)
|
0
⟩
|
0
⟩
=
α
|
000
⟩
+
β
|
100
⟩
.
Lastly, you encode the single qubit into a joint state of three qubits, by applying two CNOT operations. The first CNOT uses the first qubit as control and acts on the second qubit, producing
α
|
000
⟩
+
β
|
110
⟩
. The second CNOT uses the first qubit as control and acts on the third qubit. The state of the three qubits is now
α
|
000
⟩
+
β
|
111
⟩
.
You send all three qubits. Assuming only one-bit flip errors can occur, the received qubits are in one of the following states:
State
Error
α
|
000
⟩
+
β
|
111
⟩
No error
α
|
100
⟩
+
β
|
011
⟩
Qubit 1
α
|
010
⟩
+
β
|
101
⟩
Qubit 2
α
|
001
⟩
+
β
|
110
⟩
Qubit 3
First, you introduce two more qubits, prepared in the state
|
00
⟩
. This auxiliary pair of qubits are used to extract information of the error without directly measuring or obtaining information about the logical state.
Next, you carry out four CNOT operations: the first two operations use the first and second received qubits as control and act on the first auxiliary qubit, and last two operations use the first and third received qubits as control and act on the second auxiliary bit. The total state of all five qubits is now:
State
Error
(
α
|
000
⟩
+
β
|
111
⟩
)
|
00
⟩
No error
(
α
|
100
⟩
+
β
|
011
⟩
)
|
11
⟩
Qubit 1
(
α
|
010
⟩
+
β
|
101
⟩
)
|
10
⟩
Qubit 2
(
α
|
001
⟩
+
β
|
110
⟩
)
|
01
⟩
Qubit 3
To retrieve the error information, you measure the two auxiliary qubits in the computational basis states
|
0
⟩
and
|
1
⟩
. By doing this, you recover the joint state, which is called the
error syndrome
because it helps diagnose the errors in the received qubits.
Now you know which of the four possible states the three received qubits are in. You can correct the error by applying the correction operation. In this case you're dealing with bit flip errors, so the correction is a
σ
x
operation applied to one (or none) of the qubits.
For example, if the error syndrome is
|
00
⟩
, then the received qubits are in the state
α
|
000
⟩
+
β
|
111
⟩
, which is the state you originally sent. If the error syndrome is
|
11
⟩
, then the received qubits are in the state
α
|
100
⟩
+
b
|
011
⟩
. There's a bit flip error on the first qubit, which you can correct by applying a
σ
x
operation to the first qubit.
Error syndrome
Collapse state
Correction
|
00
⟩
α
|
000
⟩
+
β
|
111
⟩
Do nothing
|
01
⟩
α
|
100
⟩
+
β
|
011
⟩
Apply
σ
x
to qubit 3
|
10
⟩
α
|
010
⟩
+
β
|
101
⟩
Apply
σ
x
to qubit 2
|
11
⟩
α
|
001
⟩
+
β
|
110
⟩
Apply
σ
x
to qubit 1
Finally, to extract the single qubit you wanted to transmit originally, you apply two CNOT operations: one uses the first qubit as control and acts on the second qubit, and other uses the first qubit as control and acts on the third one.
The state of the first qubit is now
α
|
0
⟩
+
β
|
1
⟩
, which is the original qubit you wanted to transmit.
Important
The QEC code doesn't gain any information regarding the coefficients
α
and
β
, hence superpositions of the computational state remain intact during correction. |
| Markdown | [Skip to main content](https://learn.microsoft.com/en-us/azure/quantum/concepts-error-correction#main) [Skip to Ask Learn chat experience](https://learn.microsoft.com/en-us/azure/quantum/concepts-error-correction)
## Microsoft Build 2026
June 2-3, 2026
Go deep on real code and real systems in San Francisco and online
[Learn more](https://aka.ms/MSBuild_FY26_BN_MSLearn_Hero)
Dismiss alert
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
[Download Microsoft Edge](https://go.microsoft.com/fwlink/p/?LinkID=2092881%20) [More info about Internet Explorer and Microsoft Edge](https://learn.microsoft.com/en-us/lifecycle/faq/internet-explorer-microsoft-edge)
[Learn](https://learn.microsoft.com/en-us/)
[Sign in](https://learn.microsoft.com/en-us/azure/quantum/concepts-error-correction)
![]()
![]()
- [Profile](https://learn.microsoft.com/en-us/users/me/activity/)
- [Settings](https://learn.microsoft.com/en-us/users/me/settings/)
[Sign out](https://learn.microsoft.com/en-us/azure/quantum/concepts-error-correction)
[Learn](https://learn.microsoft.com/en-us/)
- Documentation
- [All product documentation](https://learn.microsoft.com/en-us/docs/)
- [Azure documentation](https://learn.microsoft.com/en-us/azure/?product=popular)
- [Dynamics 365 documentation](https://learn.microsoft.com/en-us/dynamics365/)
- [Microsoft Copilot documentation](https://learn.microsoft.com/en-us/copilot/)
- [Microsoft 365 documentation](https://learn.microsoft.com/en-us/microsoft-365/)
- [Power Platform documentation](https://learn.microsoft.com/en-us/power-platform/)
- [Code samples](https://learn.microsoft.com/en-us/samples/)
- [Troubleshooting documentation](https://learn.microsoft.com/en-us/troubleshoot/)
Free to join. Request to attend.
[Microsoft AI Tour](https://aitour.microsoft.com/?wt.mc_id=itour26_learnmarketingspot_wwl)
Take your business to the AI frontier.
- Training & Labs
- [All training](https://learn.microsoft.com/en-us/training/)
- [Azure training](https://learn.microsoft.com/en-us/training/browse/?products=azure)
- [Dynamics 365 training](https://learn.microsoft.com/en-us/training/browse/?products=dynamics-365)
- [Microsoft Copilot training](https://learn.microsoft.com/en-us/training/browse/?products=ms-copilot)
- [Microsoft 365 training](https://learn.microsoft.com/en-us/training/browse/?products=m365)
- [Microsoft Power Platform training](https://learn.microsoft.com/en-us/training/browse/?products=power-platform)
- [Labs](https://learn.microsoft.com/en-us/labs/)
- [Credentials](https://learn.microsoft.com/en-us/credentials/)
- [Career paths](https://learn.microsoft.com/en-us/training/career-paths/)
Free to join. Request to attend.
[Microsoft AI Tour](https://aitour.microsoft.com/?wt.mc_id=itour26_learnmarketingspot_wwl)
Take your business to the AI frontier.
- Q\&A
- [Ask a question](https://learn.microsoft.com/en-us/answers/questions/ask/)
- [Azure questions](https://learn.microsoft.com/en-us/answers/tags/133/azure/)
- [Windows questions](https://learn.microsoft.com/en-us/answers/tags/60/windows/)
- [Microsoft 365 questions](https://learn.microsoft.com/en-us/answers/tags/9/m365/)
- [Microsoft Outlook questions](https://learn.microsoft.com/en-us/answers/tags/131/office-outlook/)
- [Microsoft Teams questions](https://learn.microsoft.com/en-us/answers/tags/108/office-teams/)
- [Popular tags](https://learn.microsoft.com/en-us/answers/tags/)
- [All questions](https://learn.microsoft.com/en-us/answers/questions/)
Free to join. Request to attend.
[Microsoft AI Tour](https://aitour.microsoft.com/?wt.mc_id=itour26_learnmarketingspot_wwl)
Take your business to the AI frontier.
- Topics
- [Artificial intelligence](https://learn.microsoft.com/en-us/ai/)
Learning hub to build AI skills
- [Compliance](https://learn.microsoft.com/en-us/compliance/)
Compliance resources you need to get started with your business
- [DevOps](https://learn.microsoft.com/en-us/devops/)
DevOps practices, Git version control and Agile methods
- [Learn for Organizations](https://learn.microsoft.com/en-us/training/organizations/)
Curated offerings from Microsoft to boost your team’s technical skills
- [Platform engineering](https://learn.microsoft.com/en-us/platform-engineering/)
Tools from Microsoft and others to build personalized developer experiences
- [Security](https://learn.microsoft.com/en-us/security/)
Guidance to help you tackle security challenges
- [Assessments](https://learn.microsoft.com/en-us/assessments/)
Interactive guidance with custom recommendations
- [Student hub](https://learn.microsoft.com/en-us/training/student-hub/)
Self-paced and interactive training for students
- [Educator center](https://learn.microsoft.com/en-us/training/educator-center/)
Resources for educators to bring technical innovation in their classroom
Free to join. Request to attend.
[Microsoft AI Tour](https://aitour.microsoft.com/?wt.mc_id=itour26_learnmarketingspot_wwl)
Take your business to the AI frontier.
[Sign in](https://learn.microsoft.com/en-us/azure/quantum/concepts-error-correction)
![]()
![]()
- [Profile](https://learn.microsoft.com/en-us/users/me/activity/)
- [Settings](https://learn.microsoft.com/en-us/users/me/settings/)
[Sign out](https://learn.microsoft.com/en-us/azure/quantum/concepts-error-correction)
[Azure](https://learn.microsoft.com/en-us/azure/)
- Products
- Popular products
- [Microsoft Foundry](https://learn.microsoft.com/en-us/azure/ai-foundry/)
- [Azure App Service](https://learn.microsoft.com/en-us/azure/app-service/)
- [Azure Databricks](https://learn.microsoft.com/en-us/azure/databricks/)
- [Azure DevOps](https://learn.microsoft.com/en-us/azure/devops/)
- [Azure Functions](https://learn.microsoft.com/en-us/azure/azure-functions/)
- [Azure Monitor](https://learn.microsoft.com/en-us/azure/azure-monitor/)
- [Azure Virtual Machines](https://learn.microsoft.com/en-us/azure/virtual-machines/)
- Popular categories
- [Compute](https://learn.microsoft.com/en-us/azure/?product=compute)
- [Networking](https://learn.microsoft.com/en-us/azure/?product=networking)
- [Storage](https://learn.microsoft.com/en-us/azure/?product=storage)
- [AI & machine learning](https://learn.microsoft.com/en-us/azure/?product=ai-machine-learning)
- [Analytics](https://learn.microsoft.com/en-us/azure/?product=analytics)
- [Databases](https://learn.microsoft.com/en-us/azure/?product=databases)
- [Security](https://learn.microsoft.com/en-us/azure/?product=security)
- [View all products](https://learn.microsoft.com/en-us/azure/)
- Architecture
- [Cloud Adoption Framework](https://learn.microsoft.com/en-us/azure/cloud-adoption-framework/)
- [Well-Architected Framework](https://learn.microsoft.com/en-us/azure/well-architected/)
- [Azure Architecture Center](https://learn.microsoft.com/en-us/azure/architecture/)
- [Migration](https://learn.microsoft.com/en-us/azure/migration/)
- Develop
- [Python](https://learn.microsoft.com/en-us/azure/developer/python/)
- [.NET](https://learn.microsoft.com/en-us/dotnet/azure/)
- [JavaScript](https://learn.microsoft.com/en-us/azure/developer/javascript/)
- [Java](https://learn.microsoft.com/en-us/azure/developer/java/)
- [PowerShell](https://learn.microsoft.com/en-us/powershell/azure/)
- [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/)
- [View all developer resources](https://learn.microsoft.com/en-us/azure/developer/)
- Learn Azure
- [Start your AI learning assessment](https://learn.microsoft.com/en-us/assessments/1c032171-8ca0-4032-8962-a38a5cc424a8/)
- Top learning paths
- [Cloud concepts](https://learn.microsoft.com/en-us/training/paths/microsoft-azure-fundamentals-describe-cloud-concepts/)
- [AI fundamentals](https://learn.microsoft.com/en-us/training/paths/get-started-with-artificial-intelligence-on-azure/)
- [Intro to generative AI](https://learn.microsoft.com/en-us/training/paths/introduction-generative-ai/)
- [Azure Architecture fundamentals](https://learn.microsoft.com/en-us/training/paths/azure-fundamentals-describe-azure-architecture-services/)
- [Earn credentials](https://learn.microsoft.com/en-us/credentials/browse/?products=azure)
- [Instructor-led courses](https://learn.microsoft.com/en-us/training/browse/?products=azure&resource_type=course)
- [View all training](https://learn.microsoft.com/en-us/training/azure/)
- [Troubleshooting](https://learn.microsoft.com/en-us/troubleshoot/azure/)
- Resources
- [Product overview](https://azure.microsoft.com/get-started)
- [Azure updates](https://azure.microsoft.com/updates)
- [Pricing information](https://azure.microsoft.com/pricing/)
- [Cost management & billing](https://learn.microsoft.com/en-us/azure/cost-management-billing/)
- [Latest blog posts](https://azure.microsoft.com/blog/)
- [Support options](https://azure.microsoft.com/support/options/)
- More
- Products
- Popular products
- [Microsoft Foundry](https://learn.microsoft.com/en-us/azure/ai-foundry/)
- [Azure App Service](https://learn.microsoft.com/en-us/azure/app-service/)
- [Azure Databricks](https://learn.microsoft.com/en-us/azure/databricks/)
- [Azure DevOps](https://learn.microsoft.com/en-us/azure/devops/)
- [Azure Functions](https://learn.microsoft.com/en-us/azure/azure-functions/)
- [Azure Monitor](https://learn.microsoft.com/en-us/azure/azure-monitor/)
- [Azure Virtual Machines](https://learn.microsoft.com/en-us/azure/virtual-machines/)
- Popular categories
- [Compute](https://learn.microsoft.com/en-us/azure/?product=compute)
- [Networking](https://learn.microsoft.com/en-us/azure/?product=networking)
- [Storage](https://learn.microsoft.com/en-us/azure/?product=storage)
- [AI & machine learning](https://learn.microsoft.com/en-us/azure/?product=ai-machine-learning)
- [Analytics](https://learn.microsoft.com/en-us/azure/?product=analytics)
- [Databases](https://learn.microsoft.com/en-us/azure/?product=databases)
- [Security](https://learn.microsoft.com/en-us/azure/?product=security)
- [View all products](https://learn.microsoft.com/en-us/azure/)
- Architecture
- [Cloud Adoption Framework](https://learn.microsoft.com/en-us/azure/cloud-adoption-framework/)
- [Well-Architected Framework](https://learn.microsoft.com/en-us/azure/well-architected/)
- [Azure Architecture Center](https://learn.microsoft.com/en-us/azure/architecture/)
- [Migration](https://learn.microsoft.com/en-us/azure/migration/)
- Develop
- [Python](https://learn.microsoft.com/en-us/azure/developer/python/)
- [.NET](https://learn.microsoft.com/en-us/dotnet/azure/)
- [JavaScript](https://learn.microsoft.com/en-us/azure/developer/javascript/)
- [Java](https://learn.microsoft.com/en-us/azure/developer/java/)
- [PowerShell](https://learn.microsoft.com/en-us/powershell/azure/)
- [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/)
- [View all developer resources](https://learn.microsoft.com/en-us/azure/developer/)
- Learn Azure
- [Start your AI learning assessment](https://learn.microsoft.com/en-us/assessments/1c032171-8ca0-4032-8962-a38a5cc424a8/)
- Top learning paths
- [Cloud concepts](https://learn.microsoft.com/en-us/training/paths/microsoft-azure-fundamentals-describe-cloud-concepts/)
- [AI fundamentals](https://learn.microsoft.com/en-us/training/paths/get-started-with-artificial-intelligence-on-azure/)
- [Intro to generative AI](https://learn.microsoft.com/en-us/training/paths/introduction-generative-ai/)
- [Azure Architecture fundamentals](https://learn.microsoft.com/en-us/training/paths/azure-fundamentals-describe-azure-architecture-services/)
- [Earn credentials](https://learn.microsoft.com/en-us/credentials/browse/?products=azure)
- [Instructor-led courses](https://learn.microsoft.com/en-us/training/browse/?products=azure&resource_type=course)
- [View all training](https://learn.microsoft.com/en-us/training/azure/)
- [Troubleshooting](https://learn.microsoft.com/en-us/troubleshoot/azure/)
- Resources
- [Product overview](https://azure.microsoft.com/get-started)
- [Azure updates](https://azure.microsoft.com/updates)
- [Pricing information](https://azure.microsoft.com/pricing/)
- [Cost management & billing](https://learn.microsoft.com/en-us/azure/cost-management-billing/)
- [Latest blog posts](https://azure.microsoft.com/blog/)
- [Support options](https://azure.microsoft.com/support/options/)
[Portal](https://portal.azure.com/) [Get started with Azure](https://azure.microsoft.com/pricing/purchase-options/azure-account?cid=msft_learn)
- [Microsoft Quantum documentation](https://learn.microsoft.com/en-us/azure/quantum/)
- Overview
- The Azure Quantum service
- The Microsoft Quantum Development Kit
- Concepts in quantum computing
- [Vectors and matrices](https://learn.microsoft.com/en-us/azure/quantum/concepts-vectors-and-matrices)
- [The qubit](https://learn.microsoft.com/en-us/azure/quantum/concepts-the-qubit)
- [Multiple qubits](https://learn.microsoft.com/en-us/azure/quantum/concepts-multiple-qubits)
- [Dirac notation](https://learn.microsoft.com/en-us/azure/quantum/concepts-dirac-notation)
- [Pauli measurements](https://learn.microsoft.com/en-us/azure/quantum/concepts-pauli-measurements)
- [Grover's algorithm](https://learn.microsoft.com/en-us/azure/quantum/concepts-grovers)
- [Quantum circuits conventions](https://learn.microsoft.com/en-us/azure/quantum/concepts-circuits)
- [Quantum entanglement](https://learn.microsoft.com/en-us/azure/quantum/concepts-entanglement)
- [Quantum error correction](https://learn.microsoft.com/en-us/azure/quantum/concepts-error-correction)
- [Quantum Intermediate Representation](https://learn.microsoft.com/en-us/azure/quantum/concepts-qir)
- [Quantum oracles](https://learn.microsoft.com/en-us/azure/quantum/concepts-oracles)
- [T gates & T factories](https://learn.microsoft.com/en-us/azure/quantum/concepts-tfactories)
- [Concepts for hybrid QC](https://learn.microsoft.com/en-us/azure/quantum/hybrid-computing-concepts)
- Resources
- API reference
Download PDF
Table of contents
Exit editor mode
1. [Learn](https://learn.microsoft.com/en-us/)
2. [Azure](https://learn.microsoft.com/en-us/azure/)
3. [Quantum](https://learn.microsoft.com/en-us/azure/quantum/)
4. [Concepts in quantum computing](https://learn.microsoft.com/en-us/azure/quantum/concepts-vectors-and-matrices)
1. [Learn](https://learn.microsoft.com/en-us/)
2. [Azure](https://learn.microsoft.com/en-us/azure/)
3. [Quantum](https://learn.microsoft.com/en-us/azure/quantum/)
4. [Concepts in quantum computing](https://learn.microsoft.com/en-us/azure/quantum/concepts-vectors-and-matrices)
Ask Learn
Ask Learn
Focus mode
Table of contents
[Read in English](https://learn.microsoft.com/en-us/azure/quantum/concepts-error-correction)
Add to Collections
Add to plan
[Edit](https://github.com/MicrosoftDocs/quantum-docs/blob/main/articles/concepts-error-correction.md)
***
#### Share via
[Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Flearn.microsoft.com%2Fen-us%2Fazure%2Fquantum%2Fconcepts-error-correction%3FWT.mc_id%3Dfacebook) [x.com](https://twitter.com/intent/tweet?original_referer=https%3A%2F%2Flearn.microsoft.com%2Fen-us%2Fazure%2Fquantum%2Fconcepts-error-correction%3FWT.mc_id%3Dtwitter&tw_p=tweetbutton&url=https%3A%2F%2Flearn.microsoft.com%2Fen-us%2Fazure%2Fquantum%2Fconcepts-error-correction%3FWT.mc_id%3Dtwitter) [LinkedIn](https://www.linkedin.com/feed/?shareActive=true&text=%0A%0D%0Ahttps%3A%2F%2Flearn.microsoft.com%2Fen-us%2Fazure%2Fquantum%2Fconcepts-error-correction%3FWT.mc_id%3Dlinkedin) [Email](mailto:?subject=%5BShared%20Article%5D%20Quantum%20Error%20Correction%20Codes%20-%20Azure%20Quantum%20%7C%20Microsoft%20Learn&body=%0A%0D%0Ahttps%3A%2F%2Flearn.microsoft.com%2Fen-us%2Fazure%2Fquantum%2Fconcepts-error-correction%3FWT.mc_id%3Demail)
***
Copy Markdown
Print
***
Note
Access to this page requires authorization. You can try [signing in](https://learn.microsoft.com/en-us/azure/quantum/concepts-error-correction) or [changing directories]().
Access to this page requires authorization. You can try [changing directories]().
# Introduction to quantum error correction
Feedback
Summarize this article for me
## In this article
1. [What is quantum error correction?](https://learn.microsoft.com/en-us/azure/quantum/concepts-error-correction#what-is-quantum-error-correction)
2. [Types of quantum errors](https://learn.microsoft.com/en-us/azure/quantum/concepts-error-correction#types-of-quantum-errors)
3. [How does quantum error correction work?](https://learn.microsoft.com/en-us/azure/quantum/concepts-error-correction#how-does-quantum-error-correction-work)
4. [Types of QEC codes](https://learn.microsoft.com/en-us/azure/quantum/concepts-error-correction#types-of-qec-codes)
5. [Example: The three-qubit code](https://learn.microsoft.com/en-us/azure/quantum/concepts-error-correction#example-the-three-qubit-code)
This article explains the basics of quantum error correction, the types of quantum errors, and some common quantum error correction codes. It also provides an example of how to correct errors using the three-qubit code.
## What is quantum error correction?
Quantum error correction (QEC) is a technique that allows us to protect quantum information from errors. Error correction is especially important in quantum computers, because efficient quantum algorithms make use of large-scale quantum computers, which are sensitive to noise.
The basic principle behind quantum error correction is that the number of bits used to encode a given amount of information is increased. This redundancy allows the code to detect and correct errors.
The error rates for quantum computers are typically higher than classical computer's errors due to the challenges associated with building and operating quantum systems. Noise, decoherence, and imperfections in quantum gates can cause errors in quantum computations. Current quantum computers have error rates in the range of 1% to 0.1%. In other words, this means that on average one out of every 100 to 1000 quantum gate operations results in an error.
## Types of quantum errors
There are two fundamental types of quantum errors: bit flips and phase flips.
Bit flip errors occur when a qubit changes from \| 0 ⟩ to \| 1 ⟩ or vice versa. Bit flip errors are also known as σ x\-errors, because they map the qubit states σ x \| 0 ⟩ \= \| 1 ⟩ and σ x \| 1 ⟩ \= \| 0 ⟩. This error is analogous to a classical bit flip error.
Phase flip errors occur when a qubit changes its phase. They are also known as σ z\-errors, because they map the qubit states σ z \| 0 ⟩ \= \| 0 ⟩ and σ z \| 1 ⟩ \= − \| 1 ⟩. This type of error has no classical analog.
In quantum computing, quantum errors can manifest as bit flips, phase flips, or a combination of both.
## How does quantum error correction work?
Quantum error correction codes work by encoding the quantum information into a larger set of qubits, called the *physical qubits*. The joint state of the physical qubits represents a *logical qubit*.
The physical qubits are subject to errors due to decoherence and imperfections in quantum gates. The code is designed so that errors can be detected and corrected by measuring some of the qubits in the code.
For example, imagine you want to send the single-qubit message \| 0 ⟩. You could use three physical qubits to encode the message, sending \| 000 ⟩, which is known as a *codeword*. This error-correcting code is a *repetition code*, because the message is repeated three times.
Now, imagine that a single bit-flip error occurs during transmission so that what the recipient receives is the state \| 010 ⟩. In this scenario, the recipient may be able to infer that the intended message is \| 000 ⟩. However, if the message is subject to two bit-flip errors, the recipient may infer an incorrect message. Finally, if all three bits are flipped so that the original message \| 000 ⟩ becomes \| 111 ⟩, the recipient has no way of knowing an error occurred.
The code distance of a QEC code is the minimum number of errors that change one codeword into another, that is, the number of errors that can't be detected. The code distance d can be defined as
d \= 2 t \+ 1
where t is the number of errors the code can correct. For example, the three-bit code can detect and correct one bit-flip error, so t \= 1, and thus the code distance is d \= 3.
Note that repetition codes, such as the three-bit code used in this example, can only correct bit-flip errors, and not phase flip errors. To correct both types of errors, more sophisticated quantum error correction codes are needed.
## Types of QEC codes
There are many different types of QEC codes, each with its own properties and advantages. Some common QEC codes are:
- **Repetition code:** The simplest quantum error correction code, where a single qubit is encoded into multiple qubits by repeating it multiple times. The repetition code can correct bit flip errors, but not phase flip errors.
- **Shor code:** The first quantum error correction code, developed by Peter Shor. It encodes one logical qubit into nine physical qubits. Shor code can correct one-bit flip error or one phase flip error, but it can't correct both types of errors at the same time.
- **Steane code:** This is a seven-qubit code that can correct both bit flip and phase flip errors. It has the advantage of being fault-tolerant, meaning that the error correction process itself doesn't introduce extra errors.
- **Surface code:** This is a topological error correction code that uses a two-dimensional lattice of qubits to encode logical qubits. It has a high error correction threshold and is considered one of the most promising techniques for large-scale, fault-tolerant quantum computing. The surface code is used by the [Microsoft Quantum resource estimator](https://learn.microsoft.com/en-us/azure/quantum/overview-resources-estimator#quantum-error-correction-schemes).
- **Hastings-Haah code:** This quantum error correction code offers better space-time costs than surface codes on Majorana qubits in many regimes. For gate-based instruction sets, the overhead is larger, which makes this approach less efficient than the surface code.
## Example: The three-qubit code
The three-qubit error correction code is a simple repetition code that can detect and correct one bit flip error. It encodes a single logical qubit into three physical qubits by repeating the qubit three times.
Tip
Check out the [Q\# code sample for the three-qubit code](https://github.com/microsoft/qdk/blob/main/samples/algorithms/ThreeQubitRepetitionCode.qs).
Imagine you want to send an arbitrary single qubit \| ϕ ⟩ \= α \| 0 ⟩ \+ β \| 1 ⟩. To avoid errors, you encode the basis states \| 0 ⟩ and \| 1 ⟩ into a joint state of three qubits. The two logical basis states are \| 0 L ⟩ \= \| 000 ⟩ and \| 1 L ⟩ \= \| 111 ⟩.
Therefore, the single qubit \| ϕ ⟩ \= α \| 0 ⟩ \+ β \| 1 ⟩ is encoded as:
\| ϕ L ⟩ \= α \| 000 ⟩ \+ β \| 111 ⟩ \= α \| 0 L ⟩ \+ β \| 1 L ⟩
Let's break down the steps of the three-qubit code.
### Preparing the qubits
First, you encode your single qubit \| ϕ ⟩ \= α \| 0 ⟩ \+ β \| 1 ⟩ into a joint state of three qubits.
Next, you prepare two further qubits in the state \| 0 ⟩. So, the global state of all three qubits is ( α \| 0 ⟩ \+ β \| 1 ⟩ ) \| 0 ⟩ \| 0 ⟩ \= α \| 000 ⟩ \+ β \| 100 ⟩.
Lastly, you encode the single qubit into a joint state of three qubits, by applying two CNOT operations. The first CNOT uses the first qubit as control and acts on the second qubit, producing α \| 000 ⟩ \+ β \| 110 ⟩. The second CNOT uses the first qubit as control and acts on the third qubit. The state of the three qubits is now α \| 000 ⟩ \+ β \| 111 ⟩.
### Sending the qubits
You send all three qubits. Assuming only one-bit flip errors can occur, the received qubits are in one of the following states:
Expand table
| State | Error |
|---|---|
| α \| 000 ⟩ \+ β \| 111 ⟩ | No error |
| α \| 100 ⟩ \+ β \| 011 ⟩ | Qubit 1 |
| α \| 010 ⟩ \+ β \| 101 ⟩ | Qubit 2 |
| α \| 001 ⟩ \+ β \| 110 ⟩ | Qubit 3 |
### Adding auxiliary qubits
First, you introduce two more qubits, prepared in the state \| 00 ⟩. This auxiliary pair of qubits are used to extract information of the error without directly measuring or obtaining information about the logical state.
Next, you carry out four CNOT operations: the first two operations use the first and second received qubits as control and act on the first auxiliary qubit, and last two operations use the first and third received qubits as control and act on the second auxiliary bit. The total state of all five qubits is now:
Expand table
| State | Error |
|---|---|
| ( α \| 000 ⟩ \+ β \| 111 ⟩ ) \| 00 ⟩ | No error |
| ( α \| 100 ⟩ \+ β \| 011 ⟩ ) \| 11 ⟩ | Qubit 1 |
| ( α \| 010 ⟩ \+ β \| 101 ⟩ ) \| 10 ⟩ | Qubit 2 |
| ( α \| 001 ⟩ \+ β \| 110 ⟩ ) \| 01 ⟩ | Qubit 3 |
### Retrieving the error syndrome
To retrieve the error information, you measure the two auxiliary qubits in the computational basis states \| 0 ⟩ and \| 1 ⟩. By doing this, you recover the joint state, which is called the *error syndrome* because it helps diagnose the errors in the received qubits.
Now you know which of the four possible states the three received qubits are in. You can correct the error by applying the correction operation. In this case you're dealing with bit flip errors, so the correction is a σ x operation applied to one (or none) of the qubits.
For example, if the error syndrome is \| 00 ⟩, then the received qubits are in the state α \| 000 ⟩ \+ β \| 111 ⟩, which is the state you originally sent. If the error syndrome is \| 11 ⟩, then the received qubits are in the state α \| 100 ⟩ \+ b \| 011 ⟩. There's a bit flip error on the first qubit, which you can correct by applying a σ x operation to the first qubit.
Expand table
| Error syndrome | Collapse state | Correction |
|---|---|---|
| \| 00 ⟩ | α \| 000 ⟩ \+ β \| 111 ⟩ | Do nothing |
| \| 01 ⟩ | α \| 100 ⟩ \+ β \| 011 ⟩ | Apply σ x to qubit 3 |
| \| 10 ⟩ | α \| 010 ⟩ \+ β \| 101 ⟩ | Apply σ x to qubit 2 |
| \| 11 ⟩ | α \| 001 ⟩ \+ β \| 110 ⟩ | Apply σ x to qubit 1 |
### Extracting the original qubit
Finally, to extract the single qubit you wanted to transmit originally, you apply two CNOT operations: one uses the first qubit as control and acts on the second qubit, and other uses the first qubit as control and acts on the third one.
The state of the first qubit is now α \| 0 ⟩ \+ β \| 1 ⟩, which is the original qubit you wanted to transmit.
Important
The QEC code doesn't gain any information regarding the coefficients α and β, hence superpositions of the computational state remain intact during correction.
***
## Feedback
Was this page helpful?
Yes
No
No
Need help with this topic?
Want to try using Ask Learn to clarify or guide you through this topic?
Ask Learn
Ask Learn
Suggest a fix?
***
## Additional resources
Training
Module
[Teleport entangled qubits with Q\# - Training](https://learn.microsoft.com/en-us/training/modules/explore-entanglement/?source=recommendations)
Teleport entangled qubits with Q\#
***
- Last updated on
09/16/2024
## In this article
1. [What is quantum error correction?](https://learn.microsoft.com/en-us/azure/quantum/concepts-error-correction#what-is-quantum-error-correction)
2. [Types of quantum errors](https://learn.microsoft.com/en-us/azure/quantum/concepts-error-correction#types-of-quantum-errors)
3. [How does quantum error correction work?](https://learn.microsoft.com/en-us/azure/quantum/concepts-error-correction#how-does-quantum-error-correction-work)
4. [Types of QEC codes](https://learn.microsoft.com/en-us/azure/quantum/concepts-error-correction#types-of-qec-codes)
5. [Example: The three-qubit code](https://learn.microsoft.com/en-us/azure/quantum/concepts-error-correction#example-the-three-qubit-code)
Was this page helpful?
Yes
No
No
Need help with this topic?
Want to try using Ask Learn to clarify or guide you through this topic?
Ask Learn
Ask Learn
Suggest a fix?
## Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
[Sign in](https://learn.microsoft.com/en-us/azure/quantum/concepts-error-correction)
[English (United States)](https://learn.microsoft.com/en-us/locale?target=https%3A%2F%2Flearn.microsoft.com%2Fen-us%2Fazure%2Fquantum%2Fconcepts-error-correction)
[Your Privacy Choices](https://aka.ms/yourcaliforniaprivacychoices)
Theme
- Light
- Dark
- High contrast
- [AI Disclaimer](https://learn.microsoft.com/en-us/principles-for-ai-generated-content)
- [Previous Versions](https://learn.microsoft.com/en-us/previous-versions/)
- [Blog](https://techcommunity.microsoft.com/t5/microsoft-learn-blog/bg-p/MicrosoftLearnBlog)
- [Contribute](https://learn.microsoft.com/en-us/contribute)
- [Privacy](https://go.microsoft.com/fwlink/?LinkId=521839)
- [Consumer Health Privacy](https://go.microsoft.com/fwlink/?linkid=2259814)
- [Terms of Use](https://learn.microsoft.com/en-us/legal/termsofuse)
- [Trademarks](https://www.microsoft.com/legal/intellectualproperty/Trademarks/)
- © Microsoft 2026 |
| Readable Markdown | This article explains the basics of quantum error correction, the types of quantum errors, and some common quantum error correction codes. It also provides an example of how to correct errors using the three-qubit code.
Quantum error correction (QEC) is a technique that allows us to protect quantum information from errors. Error correction is especially important in quantum computers, because efficient quantum algorithms make use of large-scale quantum computers, which are sensitive to noise.
The basic principle behind quantum error correction is that the number of bits used to encode a given amount of information is increased. This redundancy allows the code to detect and correct errors.
The error rates for quantum computers are typically higher than classical computer's errors due to the challenges associated with building and operating quantum systems. Noise, decoherence, and imperfections in quantum gates can cause errors in quantum computations. Current quantum computers have error rates in the range of 1% to 0.1%. In other words, this means that on average one out of every 100 to 1000 quantum gate operations results in an error.
There are two fundamental types of quantum errors: bit flips and phase flips.
Bit flip errors occur when a qubit changes from \| 0 ⟩ to \| 1 ⟩ or vice versa. Bit flip errors are also known as σ x\-errors, because they map the qubit states σ x \| 0 ⟩ \= \| 1 ⟩ and σ x \| 1 ⟩ \= \| 0 ⟩. This error is analogous to a classical bit flip error.
Phase flip errors occur when a qubit changes its phase. They are also known as σ z\-errors, because they map the qubit states σ z \| 0 ⟩ \= \| 0 ⟩ and σ z \| 1 ⟩ \= − \| 1 ⟩. This type of error has no classical analog.
In quantum computing, quantum errors can manifest as bit flips, phase flips, or a combination of both.
Quantum error correction codes work by encoding the quantum information into a larger set of qubits, called the *physical qubits*. The joint state of the physical qubits represents a *logical qubit*.
The physical qubits are subject to errors due to decoherence and imperfections in quantum gates. The code is designed so that errors can be detected and corrected by measuring some of the qubits in the code.
For example, imagine you want to send the single-qubit message \| 0 ⟩. You could use three physical qubits to encode the message, sending \| 000 ⟩, which is known as a *codeword*. This error-correcting code is a *repetition code*, because the message is repeated three times.
Now, imagine that a single bit-flip error occurs during transmission so that what the recipient receives is the state \| 010 ⟩. In this scenario, the recipient may be able to infer that the intended message is \| 000 ⟩. However, if the message is subject to two bit-flip errors, the recipient may infer an incorrect message. Finally, if all three bits are flipped so that the original message \| 000 ⟩ becomes \| 111 ⟩, the recipient has no way of knowing an error occurred.
The code distance of a QEC code is the minimum number of errors that change one codeword into another, that is, the number of errors that can't be detected. The code distance d can be defined as
d \= 2 t \+ 1
where t is the number of errors the code can correct. For example, the three-bit code can detect and correct one bit-flip error, so t \= 1, and thus the code distance is d \= 3.
Note that repetition codes, such as the three-bit code used in this example, can only correct bit-flip errors, and not phase flip errors. To correct both types of errors, more sophisticated quantum error correction codes are needed.
There are many different types of QEC codes, each with its own properties and advantages. Some common QEC codes are:
- **Repetition code:** The simplest quantum error correction code, where a single qubit is encoded into multiple qubits by repeating it multiple times. The repetition code can correct bit flip errors, but not phase flip errors.
- **Shor code:** The first quantum error correction code, developed by Peter Shor. It encodes one logical qubit into nine physical qubits. Shor code can correct one-bit flip error or one phase flip error, but it can't correct both types of errors at the same time.
- **Steane code:** This is a seven-qubit code that can correct both bit flip and phase flip errors. It has the advantage of being fault-tolerant, meaning that the error correction process itself doesn't introduce extra errors.
- **Surface code:** This is a topological error correction code that uses a two-dimensional lattice of qubits to encode logical qubits. It has a high error correction threshold and is considered one of the most promising techniques for large-scale, fault-tolerant quantum computing. The surface code is used by the [Microsoft Quantum resource estimator](https://learn.microsoft.com/en-us/azure/quantum/overview-resources-estimator#quantum-error-correction-schemes).
- **Hastings-Haah code:** This quantum error correction code offers better space-time costs than surface codes on Majorana qubits in many regimes. For gate-based instruction sets, the overhead is larger, which makes this approach less efficient than the surface code.
The three-qubit error correction code is a simple repetition code that can detect and correct one bit flip error. It encodes a single logical qubit into three physical qubits by repeating the qubit three times.
Imagine you want to send an arbitrary single qubit \| ϕ ⟩ \= α \| 0 ⟩ \+ β \| 1 ⟩. To avoid errors, you encode the basis states \| 0 ⟩ and \| 1 ⟩ into a joint state of three qubits. The two logical basis states are \| 0 L ⟩ \= \| 000 ⟩ and \| 1 L ⟩ \= \| 111 ⟩.
Therefore, the single qubit \| ϕ ⟩ \= α \| 0 ⟩ \+ β \| 1 ⟩ is encoded as:
\| ϕ L ⟩ \= α \| 000 ⟩ \+ β \| 111 ⟩ \= α \| 0 L ⟩ \+ β \| 1 L ⟩
Let's break down the steps of the three-qubit code.
First, you encode your single qubit \| ϕ ⟩ \= α \| 0 ⟩ \+ β \| 1 ⟩ into a joint state of three qubits.
Next, you prepare two further qubits in the state \| 0 ⟩. So, the global state of all three qubits is ( α \| 0 ⟩ \+ β \| 1 ⟩ ) \| 0 ⟩ \| 0 ⟩ \= α \| 000 ⟩ \+ β \| 100 ⟩.
Lastly, you encode the single qubit into a joint state of three qubits, by applying two CNOT operations. The first CNOT uses the first qubit as control and acts on the second qubit, producing α \| 000 ⟩ \+ β \| 110 ⟩. The second CNOT uses the first qubit as control and acts on the third qubit. The state of the three qubits is now α \| 000 ⟩ \+ β \| 111 ⟩.
You send all three qubits. Assuming only one-bit flip errors can occur, the received qubits are in one of the following states:
| State | Error |
|---|---|
| α \| 000 ⟩ \+ β \| 111 ⟩ | No error |
| α \| 100 ⟩ \+ β \| 011 ⟩ | Qubit 1 |
| α \| 010 ⟩ \+ β \| 101 ⟩ | Qubit 2 |
| α \| 001 ⟩ \+ β \| 110 ⟩ | Qubit 3 |
First, you introduce two more qubits, prepared in the state \| 00 ⟩. This auxiliary pair of qubits are used to extract information of the error without directly measuring or obtaining information about the logical state.
Next, you carry out four CNOT operations: the first two operations use the first and second received qubits as control and act on the first auxiliary qubit, and last two operations use the first and third received qubits as control and act on the second auxiliary bit. The total state of all five qubits is now:
| State | Error |
|---|---|
| ( α \| 000 ⟩ \+ β \| 111 ⟩ ) \| 00 ⟩ | No error |
| ( α \| 100 ⟩ \+ β \| 011 ⟩ ) \| 11 ⟩ | Qubit 1 |
| ( α \| 010 ⟩ \+ β \| 101 ⟩ ) \| 10 ⟩ | Qubit 2 |
| ( α \| 001 ⟩ \+ β \| 110 ⟩ ) \| 01 ⟩ | Qubit 3 |
To retrieve the error information, you measure the two auxiliary qubits in the computational basis states \| 0 ⟩ and \| 1 ⟩. By doing this, you recover the joint state, which is called the *error syndrome* because it helps diagnose the errors in the received qubits.
Now you know which of the four possible states the three received qubits are in. You can correct the error by applying the correction operation. In this case you're dealing with bit flip errors, so the correction is a σ x operation applied to one (or none) of the qubits.
For example, if the error syndrome is \| 00 ⟩, then the received qubits are in the state α \| 000 ⟩ \+ β \| 111 ⟩, which is the state you originally sent. If the error syndrome is \| 11 ⟩, then the received qubits are in the state α \| 100 ⟩ \+ b \| 011 ⟩. There's a bit flip error on the first qubit, which you can correct by applying a σ x operation to the first qubit.
| Error syndrome | Collapse state | Correction |
|---|---|---|
| \| 00 ⟩ | α \| 000 ⟩ \+ β \| 111 ⟩ | Do nothing |
| \| 01 ⟩ | α \| 100 ⟩ \+ β \| 011 ⟩ | Apply σ x to qubit 3 |
| \| 10 ⟩ | α \| 010 ⟩ \+ β \| 101 ⟩ | Apply σ x to qubit 2 |
| \| 11 ⟩ | α \| 001 ⟩ \+ β \| 110 ⟩ | Apply σ x to qubit 1 |
Finally, to extract the single qubit you wanted to transmit originally, you apply two CNOT operations: one uses the first qubit as control and acts on the second qubit, and other uses the first qubit as control and acts on the third one.
The state of the first qubit is now α \| 0 ⟩ \+ β \| 1 ⟩, which is the original qubit you wanted to transmit.
Important
The QEC code doesn't gain any information regarding the coefficients α and β, hence superpositions of the computational state remain intact during correction. |
| Shard | 168 (laksa) |
| Root Hash | 14615152987638977768 |
| Unparsed URL | com,microsoft!learn,/en-us/azure/quantum/concepts-error-correction s443 |