Tower of Hanoi
Solve the Tower of Hanoi puzzle in your browser. Move all discs to the rightmost peg!
How to play
- Click a peg to pick up its top disc (it will highlight in orange).
- Click another peg to place the disc there — you can't place a larger on a smaller.
- Move all discs from Peg A to Peg C using as few moves as possible.
- Select 3, 4, or 5 discs using the dropdown; click Restart any time.
Click a peg to select the top disc, then click another peg to move it. You can only place a smaller disc on a larger one. Move all discs to Peg C!
Frequently asked questions
- What is the minimum moves?
- The minimum number of moves is 2^n − 1. For 3 discs that is 7, for 4 discs 15, and for 5 discs 31.
- Can I move any disc?
- No — you can only move the topmost disc from any peg, and never place a larger disc on a smaller one.