How to play Tower of Hanoi
Tower of Hanoi is a free puzzle game by Extensive Harmony that you play in your web browser. Move the whole tower to the right-hand peg, one disc at a time, never a bigger disc on a smaller one. 3, 5 or 7 discs, no timer. It works on desktop and mobile — no download, no sign-up.
Goal
Move every disc from the left peg to the right peg in as few moves as possible. Only the top disc of a peg can move, and a disc may never sit on a smaller one.
Controls
- Click / Tap a peg – Lift its top disc, then tap another peg to put it down
- Keys 1-3 – Choose the left, middle or right peg
- Ctrl/Cmd + Z – Take back your last move
Tips
The smallest disc moves every second turn, always round in the same direction. With an odd number of discs, start by moving it to the right-hand peg.
How a round goes
There are three pegs. At the start every disc is on the left peg, the largest at the bottom and the smallest on top, numbered 1 (smallest) upwards. Your task is to rebuild the same tower on the right-hand peg. Each move takes the top disc of one peg and puts it on another peg, and there are only two rules: you move one disc at a time, and a disc may never be placed on a smaller disc. Easy has 3 discs, Medium 5 and Hard 7.
Tap a peg to lift its top disc, which rises above the peg so you can see what you are holding, then tap the peg where it should go. On a keyboard, keys 1, 2 and 3 choose the left, middle and right peg. Under the board you see your moves and the fewest moves possible for this tower.
A method that always works
- Think in towers, not discs. To move a tower of 3 discs to the right, you first move the top 2 out of the way onto the middle peg, then the largest disc to the right, then the 2 back on top of it. Moving the top 2 is the same puzzle, only smaller.
- Know where the smallest disc goes first. With an odd number of discs (3, 5, 7), the first move is disc 1 to the right-hand peg, where the tower should end. With an even number it goes to the middle peg.
- Move disc 1 every second turn. In the perfect solution the smallest disc moves on turns 1, 3, 5 and so on, and always round in the same direction: with an odd number of discs, from left to right to middle to left again.
- In between, make the only other legal move. When disc 1 has just moved, there is exactly one move that does not touch it. Make that one. Following these two steps solves any tower in the fewest moves without having to plan.
- Then understand why. Once you can solve 3 discs with the rhythm above, try 5 discs thinking in towers instead (step 1). It is the better exercise for planning ahead.
Situations to recognise
- The largest free disc. At any moment, ask which is the largest disc that is not yet in its final place. Everything above it must go to the one peg that is neither its current peg nor its target.
- Two moves that undo each other. Moving a disc to a peg and straight back is never part of a good solution. If you catch yourself doing it, stop and look for the largest free disc again.
- The halfway point. In a perfect solution, the largest disc moves exactly once, in the middle of the game: after 3 moves with 3 discs, after 15 with 5 and after 63 with 7. At that moment all the other discs sit as a tower on the middle peg.
Common mistakes
- Starting disc 1 towards the middle with an odd number of discs. It works, but the tower then ends on the middle peg, and you need many extra moves.
- Moving the smallest disc twice in a row. That is always a wasted move: it could have gone straight to the second place.
- Trying to solve 7 discs by trial and error. Practise the rhythm on 3 discs first; 7 discs is the same pattern, 127 moves long.
Did you know?
The puzzle was invented by the French mathematician Édouard Lucas and sold in 1883 under the name "N. Claus de Siam", an anagram of "Lucas d'Amiens". It came with a legend about a temple where priests move a tower of 64 golden discs, and the world ends when they finish. With 64 discs the fewest moves are 264 − 1, more than 18 quintillion; at one move per second that takes about 585 billion years. Tower puzzles of this kind are also used by psychologists, because they show clearly how a person plans several steps ahead.
Frequently asked questions
Is this Tower of Hanoi game free?
Yes. It runs in your web browser for free, with no download, account or sign-up, on a phone, tablet or computer.
What is the fewest number of moves?
For n discs it is 2 to the power of n, minus 1: 7 moves for 3 discs, 31 for 5 and 127 for 7. The game shows this number next to your move count, and a solution in exactly that many moves is marked as perfect.
Is there a time limit?
No. There is no clock. Only the number of moves counts, so you can stop and think at any point.
How is the score counted?
1,000 points multiplied by the best possible number of moves divided by yours, then by 1 on Easy, 2 on Medium and 4 on Hard. A perfect solve scores 1,000, 2,000 or 4,000. Taking a move back with Ctrl+Z counts as one more move.
What happens if I tap the wrong peg?
Nothing is lost. If the disc may not go there, it stays lifted and a message explains why; tap another peg. Tapping the same peg again puts the disc back down.
Keep playing
Read more
Tower of Hanoi: Solution, Formula (2^n - 1) and the Maths Behind It
More Puzzle games
- Hearthwood
- Daily Crossword
- Number Defense
- Ludo
- Hangman
- Chess
- Piano
- Ear Training
- Minesweeper
- Color Echo
- Nonogram
- Four in a Row
- Quick Math
- Schulte Table
- Code Breaker
- Box Pusher
- Checkers
- Solitaire
- Mandala Coloring
- Pairs
- FreeCell
- Word Search
- Mahjong
- Sliding Puzzle
- 2048
- Dominoes
- Sudoku
- Spider Solitaire
- Reversi
- Mancala
- TriPeaks Solitaire
- Backgammon
- Pyramid Solitaire
- Killer Sudoku
- Golf Solitaire
Part of our brain games and games for seniors collection.
New to browser games? See why playing in your browser beats installing apps.
Embed Tower of Hanoi on your website
Teachers, bloggers and site owners can add this game to a page for free. Copy the code below; please keep the credit link.
