With an odd number of discs, move the smallest disc to the right peg first. With an even number, move it to the middle peg first.
A legendary puzzle with simple rules: move a stack of discs from one peg to another, one disc at a time, without ever putting a bigger disc on a smaller one. It starts with three discs and goes up to eight. The puzzle can always be solved, and each tower has a smallest possible number of moves to aim for.
| Click or tap a peg | Pick up or drop a disc |
| 1 2 3 or A S D | Choose a peg with the keyboard |
The Tower of Hanoi has a beautiful secret: to move a tower of any size, you first move all the discs above the biggest one to the spare peg, then move the biggest disc, then move the smaller tower back on top of it. Moving that smaller tower uses exactly the same trick, so the puzzle repeats itself at every size.
There's also a simple rhythm you can follow. Every other move is the smallest disc, and it always travels in the same direction around the three pegs. On the moves in between, there's only ever one legal move that doesn't involve the smallest disc.
The fewest moves possible doubles with each disc, plus one: 7 for three discs, 15 for four, 31 for five, all the way to 255 for eight. Try to match it!
A legend says that monks in a temple are moving a tower of 64 golden discs, and the world will end when they finish. Even at one move per second, it would take them about 585 billion years.
It's 2 to the power of the number of discs, minus 1. For 3 discs that's 7.
No, but fewer moves give more points.
📖 Read more: The Tower of Hanoi: the puzzle that teaches recursion
Guide written by Noam, who makes the games on this site. Spotted a mistake or have a tip to add? Email me · About the Game Hub