🗼 Tower of Hanoi
Move the stack — one disc at a time, never larger on smaller.
Loading game…
How to Play Tower of Hanoi
- Click a peg to pick up its top disc, then click another peg to place it there.
- You can never place a larger disc on top of a smaller one.
- Move the entire stack from peg A to peg C in as few moves as possible.
- The optimal number of moves for n discs is 2ⁿ − 1.
- Use keyboard keys 1, 2, 3 to select and target pegs.
Tips & Strategy
- Start by thinking recursively: to move n discs you must first move n−1 discs out of the way.
- With 3 discs the minimum is 7 moves; with 8 discs it's 255 — plan ahead!
- Use the Auto-Solve button to watch the optimal solution animated step by step.
Tower of Hanoi — Frequently Asked Questions
What is the minimum number of moves?
For n discs the mathematical minimum is 2ⁿ − 1: 7 for three discs, 15 for four, up to 255 for eight.
Can I watch the computer solve it?
Yes — hit Auto-Solve and the game will animate every step of the optimal recursive solution. Press Stop at any time.