šŸ—¼ Tower of Hanoi

Move all discs from peg A to peg C. Never place a larger disc on a smaller one.

Discs:
Moves
0
Optimal
7
Best
—
šŸŽ‰ Solved! All discs on peg C!

Tap a peg to pick up its top disc, then tap another peg to place it.

āœ… How to Play Tower of Hanoi

  1. All discs start stacked on Peg A, largest at the bottom.
  2. Tap a peg to select its top disc (it highlights green).
  3. Tap another peg to move the disc there — but you can never place a larger disc on a smaller one.
  4. Move all discs to Peg C to win.
  5. Try to match the optimal move count: 2āæāˆ’1 moves for n discs (e.g. 7 moves for 3 discs).

Common Questions

What is the minimum number of moves?

The optimal solution requires exactly 2āæāˆ’1 moves, where n is the number of discs. That's 7 moves for 3 discs, 15 for 4, 31 for 5, 63 for 6, and 127 for 7 discs.

What is the trick to solving it?

The recursive strategy: to move n discs from A to C using B as spare — move the top nāˆ’1 discs from A to B, move the largest disc from A to C, then move the nāˆ’1 discs from B to C.

Can I use Peg B as a destination?

Yes — you can place discs on any of the three pegs at any time, as long as you never put a larger disc on top of a smaller one. Peg B is a helper peg used as temporary storage.

Is my best score saved?

Yes — your best (lowest) move count for each disc count (3–7) is saved in your browser.

Optimal Move Counts

Discs Optimal Moves Difficulty
3 7 🟢 Beginner
4 15 🟢 Easy
5 31 🟔 Medium
6 63 🟠 Hard
7 127 šŸ”“ Expert

šŸŽ® More Games on ToolsInsta

Play more free browser games — no download, no sign-up needed.