Watch RSA break
Pick a number and watch Shor’s algorithm factor it, step by step. Then see how far today’s machines are from doing the same to a real RSA key.
RSA keeps a secret by multiplying two prime numbers together. Find those two primes and the secret is out. This walks a quantum computer through finding them for a small number. Pick one, then press Next step.
- 1Find a cycle
- 2Try every number
- 3Take a reading
- 4Find the rhythm
- 5Work out the factors
The working
gcd means greatest common divisor: the biggest number that divides into both. mod means “the remainder after dividing by”.
What RSA relies on
A prime number is one that only divides by itself and 1, like 3, 5 or 53. RSA, one of the main kinds of encryption in use today, takes two very large primes, multiplies them, and publishes the result. Anyone can use that public number to lock a message or check a signature, but only someone who knows the two primes can unlock it or sign.
The bet is that multiplying is easy and going backwards isn’t. You can work out 61 × 53 = 3,233 in your head, but given only 3,233 you’d have to hunt for the two primes. A real RSA number is 617 digits long. The largest RSA number anyone has ever factored has 250 digits, and that took about 2,700 years of computer time, spread across many machines, in 2020.
The trick Shor found
In 1994 the mathematician Peter Shor showed that finding the primes can be turned into finding a cycle. Step 1 is the cycle: keep multiplying a starting number by itself, keep only the remainder after dividing by your number, and the remainders eventually repeat.
Once you know how long the cycle is, a bit of school arithmetic does the rest. Take 15 with a starting number of 7. The cycle is 4 long, so you go halfway, 2 steps: 7 × 7 = 49, which leaves 4 after dividing by 15. The numbers either side of 4 are 3 and 5, and those are the factors of 15. That isn’t luck. When the cycle has an even length, the numbers either side of the halfway point usually share a factor with the number you’re breaking, and the “gcd” lines in the working pull it out.
The hard part is finding the cycle. For a real RSA number it’s hundreds of digits long, so no ordinary computer could step through it waiting for it to come round.
Where the quantum computer comes in
Steps 2 to 4 are the quantum part, and this page calculates them exactly. The machine sets every qubit to a fair coin, so together they hold every number at once, then works out the remainder for all of them in one pass. As the first experiment showed, you can’t read all those answers out. You get one reading.
The quantum Fourier transform is what makes that one reading useful. It’s the same idea as picking the pitch out of a sound wave: it takes something that repeats and tells you how often it repeats. After it, the reading almost always lands on a peak, and the position of the peak gives away the cycle length. The machine never tries the answers one at a time.
Sometimes it fails
Run it a few times and some runs will miss. The cycle might be an odd length, or the reading might only give you part of it. Real hardware misses too. Checking an answer takes one multiplication, so you check it, and if it’s wrong you run it again.
Estimated physical qubits needed to break one RSA-2048 key, with the bars drawn to scale.
How far does it have to scale?
Factoring 15 here takes 8 qubits. A real RSA key, called RSA-2048 after its size in bits, is another matter. Real qubits make mistakes, so a working machine spreads each one across many physical qubits that check each other, and the estimates below count those physical qubits.
In 2019 the best published estimate for breaking one RSA-2048 key was 20 million physical qubits running for about eight hours. In 2025 Craig Gidney at Google cut that to under a million, running for less than a week. The largest machines built so far hold a few thousand, and none can yet run error correction at anything like that scale.
So nothing today comes close. But the target moved 20 times closer in six years, mostly through better methods rather than bigger machines, and that’s the trend security teams are watching. Next up is the encryption a quantum computer doesn’t break.
Sources (4)
- Shor: Polynomial-Time Algorithms for Prime Factorization and Discrete Logarithms on a Quantum Computer (1995)
- Gidney and Ekerå: How to factor 2048 bit RSA integers in 8 hours using 20 million noisy qubits (2019)
- Gidney: How to factor 2048 bit RSA integers with less than a million noisy qubits (2025)
- RSA Factoring Challenge numbers, including RSA-250 (factored February 2020, about 2,700 core-years)