%3C/text%3E%3C/svg%3E">
💻
💻 Tech & IT

Tower of Hanoi Moves Calculator

Results update as you type.

Your numbers

Understanding the Tower of Hanoi moves calculator — concept and principle

The Tower of Hanoi is a puzzle with three pegs and n disks of different sizes, stacked largest at the bottom. You must move the whole stack to another peg, one disk at a time, never placing a larger disk on a smaller one. This calculator gives the minimum number of moves for n disks and how long that would take at a fixed pace. It is a classic way to teach recursion, induction and exponential growth.

Tower of Hanoi with 10 disksTo move 10 disks, move the top 9 aside (511 moves), move the biggest disk once, then move the 9 back on top (511 moves): 1023 moves in total.The biggest disk moves only onceAB · 9 disksC②511① 9 disks A→B+1② big disk A→C+511③ 9 disks B→C1 → 3 → 7 → 15 → … → 1023 (×2 + 1 each disk)1023 moves → 17.05 min2¹⁰ − 1 = 1023 · 1 s each = 1023 s
511 + 1 + 511 = 1023 moves; at one move a second that takes 17.05 minutes.

How it is calculated

Disks is a whole number; seconds per move is any positive pace you choose.

The principle

To move n disks from peg A to peg C, the largest disk must move at some point, and at that moment all n − 1 smaller disks must sit on peg B. So you move n − 1 disks to B, move the largest disk once, then move the n − 1 disks onto it. This gives the recurrence M(n) = 2·M(n − 1) + 1 with M(1) = 1. Adding 1 to both sides gives M(n) + 1 = 2·(M(n − 1) + 1), so M(n) + 1 doubles with every disk and equals 2ⁿ. The argument also proves no shorter solution exists, because each step of the recursion is forced. In the optimal solution the smallest disk moves on every other turn, always in the same circular direction.

Worked example

  1. Inputs: 10 disks, 1 second per move.
  2. 2¹⁰ = 1024, so the minimum is 1024 − 1 = 1023 moves.
  3. Time = 1023 × 1 s = 1023 s.
  4. 1023 s is under one hour, so it is shown in minutes: 1023 ÷ 60 = 17.05 min.
How Minimum moves changes with DisksHow Minimum moves changes with Disks0250,000500,000750,0001e+061.25e+062.557.51012.51520Example: 1023Disks
Each point is the calculator re-run with only “Disks” changed; the gold point is the default example. Change the inputs above and this chart follows your numbers.
DisksMinimum moves
2.57
531
7.5255
101023
12.58191
1532767
201048575

How to read the result

Every extra disk roughly doubles the work. Small values are practical: 3 disks need 7 moves, 5 need 31, 8 need 255. By 20 disks the count passes one million (1,048,575), and the legend of 64 golden disks needs 18,446,744,073,709,551,615 moves, about 584.5 billion years at one move per second. This is why exponential algorithms become unusable long before inputs look large.

Common mistakes

Keep in mind: The time output assumes a perfectly steady pace with no errors or rests, and floating-point time becomes approximate for very large n even though the move count stays exact.

Frequently asked questions

What is the minimum number of moves for 3, 4 and 5 disks?

7, 15 and 31 moves respectively, from 2ⁿ − 1.

Does it matter which peg is the target?

No. Moving to either of the other two pegs takes the same 2ⁿ − 1 moves; only the first move of the smallest disk changes.

Is there a non-recursive way to solve it?

Yes. Alternate between moving the smallest disk one step in a fixed circular direction and making the only legal move that does not involve the smallest disk.

Who invented the puzzle?

The French mathematician Édouard Lucas published it in 1883, together with the legend of the 64-disk tower.

Sources: R. L. Graham, D. E. Knuth, O. Patashnik, Concrete Mathematics, Addison-Wesley, Chapter 1 (The Tower of Hanoi) · Édouard Lucas, Récréations mathématiques, Vol. 3 (1893)

Checked 8 Nov 2026. Standard formulas and RFC/IEEE definitions, computed locally in your browser — nothing you type is sent anywhere.

💻 All tech & IT tools →🌍 Calculators by country →