Tower of Hanoi Solver
Find the minimum number of moves for n discs and list the moves one by one.
Runs in your browser. Your files never leave your device. See how to check
…
How to do it
- 1Step 1: Open Tower of Hanoi Solver and add your input
Type your numbers or text, add your file, or pick the options you need. Nothing is uploaded: everything stays in your browser.
- 2Step 2: What Tower of Hanoi Solver does
Find the minimum number of moves for n discs and list the moves one by one.
- 3Step 3: Read the result and compare
The result appears at once. Change one value to see how the answer moves, then keep the figure that fits your case.
- 4Step 4: Copy or save it
Copy the result or download it. For an important decision, confirm it with the official source or an adviser.
About this tool
Enter the number of discs (1 to 64). The calculator gives the minimum number of moves 2ⁿ − 1, the time at one move per second and the first moves of the optimal solution from peg A to peg C.
The puzzle
Move all discs from A to C using B, one disc at a time, never putting a larger disc on a smaller one. The minimum is 2ⁿ − 1 moves.
Recursion
Move n − 1 discs to B, move the largest to C, then move the n − 1 discs onto it. The moves listed follow this exactly.
Worked example
5 discs need 31 moves, which is 31 seconds at one move per second. 64 discs would need more than 584 billion years.
Tips for best results
Check every box before you rely on a result, because one wrong digit changes the whole answer. Use the exact figures from your payslip, bill, certificate or contract, and keep a note of the date you calculated. Rates, thresholds and rules change from time to time, so for tax, fees and legal matters treat the output as an estimate and confirm with the official source named on this page. You can run as many scenarios as you like; nothing is saved or sent, and refreshing the page clears the boxes.
Quick facts
- Category: Games & Fun
- Works in your browser, no sign-up, no upload.
- Your input stays on your device.
- Available in many languages.
- Content last reviewed:
Frequently asked questions
Why 2ⁿ − 1?
T(n) = 2T(n−1) + 1.
Where do the discs start?
On peg A, and finish on peg C.
How many discs can I enter?
Up to 64 for the count; the move list is shown for up to 20 discs.
Is the solution unique?
The shortest solution is unique.
