Tower of Hanoi is the classic logic puzzle with three rods and a stack of discs. Move the whole tower from the left rod to the right one – one disc at a time, never a bigger disc on a smaller one. It is free, needs no download and works on phone, tablet and computer.
How to Play Tower of Hanoi
Players: 1
Discs: 3 to 8
Fewest moves: 7 to 255
Helpers: Undo · Hint · Solve
Goal: Move the whole tower from the Start rod on the left to the Target rod on the right. Finish in the fewest possible moves to earn 3 stars.
A 4-disc game in progress: disc 1 may go onto disc 2, but disc 3 may never be placed on the smaller disc 2.
Rules step by step
Choose how many discs
A game starts with 3 discs stacked on the left rod, the biggest at the bottom. Pick 3 to 8 discs with the Discs button and confirm with OK to start a new game. Each extra disc doubles the work.
Move the top disc
Drag the top disc of a rod and drop it on another rod, or tap a rod to lift its top disc and then tap the rod where it should go. While a disc is lifted, the rods where it may land light up.
Never a larger disc on a smaller one
A disc can go onto an empty rod or onto a larger disc only. If you try an illegal drop, the rod flashes red and the disc slides back.
Rebuild the tower on the right
When every disc sits on the Target rod you win. The counter shows your moves next to the minimum (for example 7/7 with 3 discs); the clock starts with your first move.
Earn stars
Finish in the minimum for 3 stars, in up to one and a half times the minimum for 2 stars, otherwise 1 star. A game in which you used a hint earns at most 2 stars.
Controls
Action
Mouse / touch
Keyboard
Move a disc
Drag it to another rod, or tap its rod and then the target rod
123 (pick up, then drop)
Put a lifted disc back
Tap the same rod again or tap outside the rods
Esc
Undo the last move
Undo button (as often as you like)
Z, Ctrl+Z or Backspace
Show a hint
Hint button
H
Solve automatically / pause
Solve button (then Pause / Keep Going)
C to solve, Space or P to pause
Change the solving speed
Speed button (0.5x, 1x, 2x, 4x)
+ / -
Number of discs
Discs button (3 to 8)
–
New game
New Game button
N or Y
Sound on / off
Speaker button (bottom right)
M
Confirm or cancel a message
OK / CANCEL
Enter / Esc
Fewest Moves and Best Results
The fewest possible moves for n discs is 2n − 1: 7 moves for 3 discs, 15 for 4, 31 for 5, 63 for 6, 127 for 7 and 255 for 8. Your best result for each number of discs – fewest moves first, then fastest time – is shown as Best in the status bar and kept in this browser. Games in which you used a hint are not saved as a best.
Hint and Auto-Solve
Hint works out the best next move from the current position: it lifts the right disc and highlights the rod it should go to – tap that rod to make the move. Solve plays the puzzle for you. Pressed before your first move, it solves a fresh tower from the start; in the middle of a game it asks first and then finishes from where you are, always by the shortest path. You can pause it, carry on with Keep Going and change its speed while it runs. A solved game earns no stars.
Strategy Tips
Move the smallest disc every other move. Always move it in the same direction around the rods.
Pick the direction by the number of discs. With an odd number, the smallest disc goes Start → Target → Spare → Start; with an even number, Start → Spare → Target → Start.
Between those moves there is only one choice. The other move never touches the smallest disc, and there is always exactly one legal one.
Think in sub-towers. To move the biggest disc, first park all the smaller discs on the Spare rod – which is the same puzzle with one disc fewer.
Learn on 3 or 4 discs. Once you can finish them in the minimum without thinking, the same pattern solves 8 discs.
Frequently asked questions
What is the minimum number of moves?
2n − 1 for n discs: 7 for 3 discs and 255 for 8. The counter shows your moves next to this number, and only a game finished in exactly the minimum earns 3 stars.
Can I undo a move?
Yes. Undo takes back your moves one by one, as far as you like, and each undone move comes off the move counter.
Why did I only get 2 stars when I used the minimum?
Using a hint limits the game to 2 stars, and such a game is not saved as your best.
Does the auto-solver always use the fewest moves?
Yes. From any position it follows the shortest path to the finished tower on the right rod.
Where does the puzzle come from?
It was published by the French mathematician Édouard Lucas in 1883, together with a legend about monks moving 64 golden discs – which would take 264 − 1 moves.
Do I need to download anything?
No. Tower of Hanoi runs in your browser on computers, tablets and phones. It is free to play and you don't need an account.