Surface Code Logical Error Rate Calculator
Introduction
The surface code is one of the best-known blueprints for fault-tolerant quantum computing because it works with a simple two-dimensional layout and can tolerate a surprisingly high level of physical noise before error correction breaks down. Instead of trusting any single physical qubit, the code spreads one logical qubit across a larger patch of many physical qubits. Repeated stabilizer measurements look for local signs of trouble, and a decoder uses those measurements to infer which physical errors probably happened. The practical engineering question is not whether the code can suppress errors in principle, but how much suppression you get for a given physical error rate and how many qubits that suppression costs.
This calculator gives a fast planning estimate for that tradeoff. If your physical error rate p sits below the threshold pth, raising the code distance d tends to reduce the logical error rate very quickly. That is the hopeful regime: more distance buys reliability. If your hardware is near or above threshold, the same extra qubits may no longer help enough, and a naive distance estimate can become misleading. The tool therefore combines a logical error estimate, a threshold check, a rough qubit overhead rule, and a target-driven distance suggestion in one place.
Because this is a compact back-of-the-envelope model, it is most useful for intuition, architecture sketches, and rough sizing conversations. It is not a substitute for a full circuit-level noise simulation with the exact decoder, syndrome-extraction schedule, leakage assumptions, and gate calibration data of a real device. Still, even a simple model is valuable because it helps you see the main shape of the tradeoff: operating farther below threshold is powerful, distance helps in discrete steps, and qubit overhead rises quickly.
How to use
Start by entering your physical error rate p. This should match the way you want to interpret the result: if you think in terms of an effective per-round error probability, use a value that reflects that round-level picture. Next enter the code distance d, which is the main size parameter of the logical patch. Then choose a threshold pth consistent with the decoder and noise assumptions you have in mind. Finally, enter a target logical error rate if you want the calculator to suggest what distance might be needed to reach that goal.
- Enter physical error rate p as a decimal value such as 0.001 for 10ā3.
- Enter code distance d as a positive integer. Odd values are common in planar layouts.
- Enter threshold pth for your assumed surface-code setup and decoder.
- Enter a target logical error rate if you want a quick sizing recommendation.
- Click Compute Logical Error to update the result panel.
When you read the output, treat it as a design estimate rather than a certification result. The logical error value tells you the approximate failure probability per effective round under the empirical model used here. The physical qubit count is a rough patch-level estimate, not a complete machine-wide budget. The recommended distance is most meaningful only in the below-threshold regime, because once p approaches or exceeds pth, the simple scaling law stops being a safe guide.
What this calculator computes
This tool returns four practical planning numbers. First, it estimates the logical error rate per round or effective cycle. Second, it checks whether your physical error rate is below the assumed threshold. Third, it uses a common rule of thumb to estimate how many physical qubits one planar logical patch may require. Fourth, it inverts the same empirical scaling law to suggest a code distance that could meet a target logical error rate, assuming you are safely below threshold.
- Estimated logical error rate per round, using a common empirical surface-code scaling law.
- Below-threshold check showing whether the entered physical error rate p is lower than the assumed threshold pth.
- Rough qubit overhead for a planar patch, using the rule of thumb n ā 2d2.
- Estimated distance required to meet a target logical error rate, when the model is operating in its intended regime.
Symbols and definitions
The symbols below appear throughout the result and explanation. Keeping them straight helps prevent one of the most common planning mistakes in quantum error correction, which is mixing up physical noise numbers, logical failure rates, and code geometry.
| Symbol | Meaning | Typical range or note |
|---|---|---|
| p | Physical error probability for the noise quantity you are modeling | Often 10ā4 to 10ā2 in projections; the below-threshold estimate only makes sense if it is less than pth |
| pth | Threshold physical error rate for the assumed code, decoder, circuit, and noise model | A common ballpark is around 0.5% to 1%, but real values vary |
| d | Code distance, or the minimum length of a nontrivial logical operator | Usually a positive integer, often odd in standard planar layouts |
| pL | Logical error rate per effective round | Falls rapidly with larger d when p is below threshold |
| n | Approximate physical qubit count for one planar logical qubit | Estimated here as n ā 2d2, which is deliberately rough |
Formulas used
A widely used empirical approximation for the planar surface code logical error rate in the below-threshold regime is shown below. The exact constants are not universal, but this form captures the basic intuition that the logical failure rate falls very quickly with distance when the physical error rate is comfortably smaller than the threshold.
The ratio p/pth tells you how close the hardware is to the threshold. The exponent ( d + 1 ) / 2 means that each increase in distance adds another power of that ratio, which is why the suppression can feel almost exponential in practice. The prefactor 0.1 is simply a convenient fit parameter from a particular family of simulations and should not be treated as a fundamental constant of nature.
For qubit overhead, the calculator uses a familiar patch-level rule of thumb:
n ā 2d2
If you provide a target logical error rate pL,target, the same scaling law can be inverted to estimate a distance requirement. In plain language, the target asks how many extra distance steps you need before the empirical suppression law pushes the logical failure rate low enough for your application.
( d + 1 ) / 2 ā log( pL,target / 0.1 ) / log( p / pth )
After solving, the result is rounded up to an integer distance, and many practitioners then choose the next odd distance because that is common in planar layouts. The calculator follows that spirit by returning a practical sizing recommendation rather than a fractional distance that no hardware layout can use directly.
Interpreting the results
If the result says you are below threshold, the model is in the regime where increasing distance should make logical faults rarer. In that regime, even a modest improvement in physical error rate can produce large savings in required distance and therefore large savings in physical qubits. This is why threshold margin matters so much: once the hardware moves farther below threshold, the economics of fault tolerance improve very quickly.
If the result says you are above threshold, be cautious. The calculator can still evaluate the empirical expression, but the qualitative promise of the surface code is no longer guaranteed by that number. Near or above threshold, increasing distance may stop helping, or help only weakly, because fresh errors arrive faster than the code can suppress the dangerous long chains that cause logical faults.
The physical qubits output is intentionally conservative in wording. A single planar patch may fit the rough estimate n ā 2d2, but real machines usually need routing space, spare ancillas, lattice-surgery work areas, magic-state support, leakage handling, and control margins that are not captured by a one-line formula. Use the estimate to compare distances, not to finalize a full architecture budget.
Worked example
Suppose your hardware model gives a physical error rate of p = 1Ć10ā3, your assumed threshold is pth = 1Ć10ā2, and you are considering a distance d = 5 patch. The key ratio is p / pth = 0.1, which means the physical noise is one tenth of threshold. The exponent is (5 + 1) / 2 = 3, so the logical error estimate becomes:
pL ā 0.1 Ć (0.1)3 = 0.1 Ć 0.001 = 1Ć10ā4
Now consider the overhead. Using n ā 2d2, the patch would require about 2 Ć 25 = 50 physical qubits. That number is not the whole computer, but it is a reasonable first estimate for one logical patch under this simplified model. Already you can see the central surface-code tradeoff: a modest logical error estimate requires a nontrivial patch of physical hardware.
If your application instead asks for a target logical error rate of 1Ć10ā6 at the same p and pth, then you solve the inverted relation for distance. In this particular example, the estimate lands around d = 9. The jump from distance 5 to distance 9 does not sound enormous at first, but the corresponding patch-level qubit count rises from roughly 50 to roughly 162. That is exactly why planning with both reliability and overhead in view matters.
Quick comparison table
The table below shows how a few small steps in distance can change both suppression and overhead. For a fixed ratio p/pth below 1, each distance increase adds another power of that ratio, so the reliability gain can be dramatic even while the qubit cost climbs rapidly.
| Distance d | Exponent (d + 1) / 2 | Estimated qubits n ā 2d² | Scaling intuition for fixed p/pth < 1 |
|---|---|---|---|
| 5 | 3 | 50 | A compact baseline distance for rough examples |
| 7 | 4 | 98 | One more power of the below-threshold ratio suppresses logical error further |
| 9 | 5 | 162 | Often a significant step toward very low logical error targets |
| 11 | 6 | 242 | Higher reliability, but the patch cost becomes much more substantial |
Assumptions and limitations
This page uses an empirical model, not a theorem that is valid for every decoder and every noise channel. The fit constant, the effective exponent, and even the best functional form can move around when you change the syndrome-extraction circuit, the decoder, the balance of gate and measurement errors, or the amount of correlated noise. Treat the number as a disciplined estimate rather than a promise.
It also compresses many kinds of hardware noise into a single scalar p. Real systems usually report separate values for one-qubit gates, two-qubit gates, measurement, idling, crosstalk, and leakage. Folding all of that into one parameter is useful for intuition, but it hides structure that can matter a great deal for a true architecture study. Likewise, the logical error rate may be quoted per round, per cycle, per logical gate, or per unit time; the calculator does not convert among those interpretations for you.
Finally, the overhead estimate is intentionally light-touch. Rotated patches, unrotated patches, lattice-surgery boundaries, spacing rules, injected-state factories, and layout choices can all shift the real qubit requirement. Even so, a compact estimate is worth having because it makes the basic scaling visible. The surface code is powerful precisely because it converts better physical qubits into sharply better logical qubits, but the price is geometric growth in hardware size. That is the trade this calculator is built to highlight.
Use the result as a fast starting point, then validate any serious hardware decision with decoder-specific simulations and architecture-aware resource estimates.
Mini-game: Chain Breaker Decoder
This optional mini-game turns the same surface-code idea into something you can feel. Red cells represent physical errors spreading across a logical patch. If they connect one boundary to the opposite boundary, a logical fault occurs. Your job is to act like a fast decoder: click or tap unstable cells to break the chain before it spans the patch. The current values of distance d and the ratio p / pth seed the starting difficulty, so a larger patch gives you more room while a ratio closer to threshold creates a busier, riskier board.
Educational takeaway: in the real surface code, a logical failure appears when a chain of physical errors becomes long enough to cross the patch. Increasing the code distance makes that path longer, while a higher physical-to-threshold error ratio makes dangerous chains appear more often.
