Strategy
Tower of Hanoi Strategy & Solution
A practical guide to solving the Tower of Hanoi: the recursive method, the by-hand three-move cycle, the odd/even first-move rule, and how to hit the 2ⁿ − 1 optimal move count every time.
Play Tower of HanoiThe core idea
Two rules solve any size
Almost every strong Tower of Hanoi habit reduces to two facts: the smallest disk moves every other turn in one fixed direction, and on the turns in between there is only one legal move. Follow those and you rebuild the tower in the theoretical minimum number of moves without ever planning more than one step ahead.
- 01
Learn the recursive shape
Every solve is the same three moves at every scale: shift the top n − 1 disks to the spare peg, move disk n to the target, then shift the n − 1 disks back on top. Once you see a puzzle as “solve n − 1, place one, solve n − 1 again”, you never have to hold the whole sequence in your head.
- 02
Alternate the smallest disk
In an optimal solution the smallest disk moves on every odd turn — 1, 3, 5, 7 — and never on two turns in a row. If you have just moved it, your next move is somewhere else; if you have not touched it since your last move, it is its turn again.
- 03
Send the smallest disk one way only
The smallest disk travels in a single loop around the three pegs and never doubles back. Choose the direction on move one and commit: for an odd number of disks send it toward the target peg, for an even number send it toward the spare peg.
- 04
On the in-between turns, take the only legal move
When it is not the smallest disk’s turn, exactly one other move is legal — there is never a choice. Find that move and make it. If you think you see two options, one of them puts a larger disk on a smaller one and is not actually legal.
- 05
Plan in sub-towers, not disks
“Solve eight disks” is not a plan. “Get the top four onto the middle peg” is. Break the puzzle into a stack of sub-goals, finish the current one before starting the next, and the move count takes care of itself.
- 06
Protect the target peg
The largest disk has to land on an empty target peg. Dropping a middle disk there early blocks it and forces a costly unwind. Before any move onto the target peg, check that it helps the next-largest disk get home.
- 07
Undo to a position you understand
If you lose the thread, do not guess forward. Step back with undo until the board matches a sub-goal you can name, then continue from there. Undo is unlimited and costs nothing.
By disk count
How the approach scales
The two rules apply at every size. What changes is how much a single wrong direction costs — see the recursion section of the guide.
3 to 4 disks
Small enough to solve by feel. Use them to drill the alternating-smallest-disk rhythm until the in-between moves feel automatic.
5 to 6 disks
The point where planning in sub-towers pays off. Name your sub-goal out loud, finish it, pick the next. Aim for the exact 31- or 63-move minimum.
7 to 8 disks
A real test of the pattern. 127 and 255 moves leave no room for a wrong direction on the smallest disk. Keep the loop direction fixed and trust the recursion.
Ready to put it into practice? Read the full how-to-play guide or jump straight in.
Play Tower of Hanoi free