Games · Free tool
Tower of Hanoi
Move all disks to the right peg. Larger disks can't go on smaller. Optimal solves in 2^n minus 1 moves.
Updated May 2026
Moves
0
Optimal
15
Move all disks from the left peg to the right. You can only place a smaller disk on top of a larger one. Click a peg to select; click another to move. Optimal solves in 2ⁿ−1 moves; for 4 disks that's 15.
Found this useful?Email
Advertisement
What it does
Classic Tower of Hanoi puzzle. Move all disks from the left peg to the right, never placing a larger disk on a smaller one. Optimal solution is 2^n − 1 moves.
Embed this tool on your siteShow snippetHide
Paste this snippet into any page. Loads on-demand (lazy), no tracking scripts, and sized to most dashboards. Replace the height to fit your layout.
<iframe src="https://freetoolarena.com/embed/tower-of-hanoi" width="100%" height="720" frameborder="0" loading="lazy" title="Tower of Hanoi" style="border:1px solid #e2e8f0;border-radius:12px;max-width:720px;"></iframe>How to use it
- Click a peg to select the top disk.
- Click another peg to move it.
- Choose 3-8 disks for difficulty.
Frequently asked questions
- What's the optimal move count?
- 2^n − 1 for n disks. So 3 disks = 7 moves, 4 = 15, 5 = 31, 8 = 255. The recursive solution is famous in computer science as the canonical recursion example.
Advertisement
Explore more games tools
- PongClassic Pong. Mouse or finger controls your paddle. Ball speeds up with each rally.
- Wordle CloneWordle-style 5-letter word guessing. 6 attempts. Green / yellow / gray feedback.
- Simon SaysMemorize and repeat color sequences. Each round adds one color. Best round saves.
- Math Speed Test60 seconds to solve as many arithmetic problems as you can. Mix of plus, minus, times, divide.
- Number GuessGuess the secret number 1-100. Higher/lower hints. Best attempts saved.
- Higher or LowerPredict whether the next card is higher, lower, or the same. Build the longest streak you can.