Tower of Hanoi
Move the whole tower, one disk at a time.
Move the whole tower to the goal peg.
Drag a disk, or tap a peg then another. Keys: 1 2 3, or arrows and Space.
How to play Tower of Hanoi
Goal
Move the whole stack of disks to the goal peg on the right.
- 1Move one disk at a time, always the top disk of a peg.
- 2A disk can only sit on an empty peg or on a bigger disk.
- 3Pick 3 to 8 disks. The smallest possible number of moves is shown above the board.
- 4Stuck? Use Undo, or watch the auto-solve demo finish from where you are.
On a computer
Drag a disk, or click a peg and then another. Keys 1, 2, 3 or arrows and Space. U to undo.
On a phone
Drag a disk to another peg, or tap a peg and then the peg to drop it on.
Play Tower of Hanoi free online. Move every disk to the goal peg, never placing a big disk on a small one. 3 to 8 disks with an auto-solve demo.
Tower of Hanoi tips and strategy
- The minimum is always 2 to the power of the disk count, minus 1. Try to match it for a perfect score.
- Move the smallest disk on every other turn. In between, make the only legal move that does not touch the smallest disk.
- With an odd number of disks, move the smallest disk first toward the goal peg. With an even number, move it first to the middle peg.
- The smallest disk always travels around the pegs in the same direction.
- Think in towers, not single disks: to free the biggest disk, the rest must first stack up on the spare peg.
- Start with 3 or 4 disks to learn the rhythm, then step up one disk at a time.
About Tower of Hanoi
Tower of Hanoi is a classic puzzle with three pegs and a stack of disks that get smaller toward the top. Your job is to move the whole stack to another peg. You may only move one disk at a time, and a larger disk can never rest on a smaller one. The rules fit in a sentence, but the number of moves grows fast: three disks need 7 moves at best, while eight disks need 255.
The puzzle was published in 1883 by the French mathematician Edouard Lucas, who wrapped it in a story about monks moving 64 golden disks. It has been a favorite in math and computer science classes ever since, because the best solution follows a neat recursive pattern. To move a tower of any height, you move the smaller tower on top out of the way, move the biggest disk, then rebuild the smaller tower on top of it.
Our version lets you choose from 3 to 8 disks, drag disks or tap pegs, and undo mistakes. If you want to see the pattern, the auto-solve demo plays the optimal moves from whatever position you are in.
Tower of Hanoi FAQ
What is the minimum number of moves for Tower of Hanoi?
For n disks it is 2 to the power of n, minus 1. That is 7 moves for 3 disks, 15 for 4, 31 for 5, 63 for 6, 127 for 7 and 255 for 8.
Is there a trick to solving Tower of Hanoi?
Yes. Alternate between moving the smallest disk and making the one other legal move. Keep the smallest disk cycling in one direction and the tower moves over in the minimum number of steps.
Can I watch the solution?
Tap Auto-solve demo. It plays the best moves from your current position, so you can also use it to get unstuck halfway.
Does my game save if I leave?
Yes. Unfinished towers are saved in your browser and come back when you return.
More puzzle games
All 22 puzzle games- DailyLevels
Lights Out
Turn off every light. Each tap flips its neighbors. - DailyLevels
Code Breaker
Crack the secret color code in ten guesses. - NewDaily
Mahjong Solitaire
Match free tiles in pairs to clear the stack. - NewDaily
Nonogram
Use number clues to reveal a hidden picture. - NewDaily
Water Sort
Pour colors until every bottle holds one shade. - NewDaily
Flow Connect
Link colored dots and fill every square. - NewLevels
Box Pusher
Push every crate onto a target in 40 levels. - NewDaily
Number Link
Join matching numbers with lines that never cross. - NewDaily
Kakuro
Cross sums: fill runs of digits to hit every clue. - NewDaily
Hex Merge
Place hex tiles and merge three of a kind.