Tower of Hanoi

The Tower of Hanoi is a classic math puzzle from 1883: shift a stack of discs from one peg to another, one disc at a time, never placing a bigger disc on a smaller one. Can you do it in the minimum number of moves?

How to play Tower of Hanoi

Controls

Tips

FAQ

What is the minimum number of moves in the Tower of Hanoi?

For n discs it is 2n − 1: 7 moves for 3 discs, 15 for 4, 31 for 5, 63 for 6 and 1023 for 10. Each extra disc doubles the work plus one move.

How do you solve the Tower of Hanoi?

Move the smallest disc in a fixed direction every second move, and in between make the only other legal move. Or think recursively: move all but the bottom disc aside, move the bottom disc, then rebuild on top of it.

Why is it called the Tower of Hanoi?

A French mathematician published the puzzle in 1883 with a story about monks moving 64 golden discs; the name was part of that invented legend. With 64 discs, the minimum would take more than 18 quintillion moves.

Does undo count as a move?

Yes. Undo takes a disc back, but the counter keeps every move you made, so a perfect score means no wasted moves at all.

Is my progress saved?

Your current puzzle, its timer and your best moves and time for every disc count are saved in this browser.