Tower of Hanoi
Play the classic Tower of Hanoi puzzle online for free. Move the whole stack of disks to the last peg, never placing a larger disk on a smaller one. Choose 3 to 8 disks.
Moves
0
Time
0:00
Disks
3
Game Area
How to Play
Controls
- Click a peg to pick up its top disk, then click another peg to drop it there. Click the same peg again to cancel the selection.
- A disk may never be placed on top of a smaller disk. Move the entire stack to peg C to win.
About
The Tower of Hanoi is a mathematical puzzle invented in 1883. Disks of decreasing size are stacked on the first of three pegs, and you must rebuild the same stack on the last peg while moving only one disk at a time. The minimum number of moves for n disks is 2^n - 1, so eight disks already require 255 moves.
Tips
- Start with 3 disks to learn the pattern, then add one disk at a time.
- Odd and even disk counts start in opposite directions — notice which first move keeps you on the optimal path.