Tower of Hanoi Play the Puzzle Online
Step 1: Choose how many disks
Step 2: Click a rod to pick up a disk, then click where to put it
© 2004–2026 QuickOnlineTips. This game’s code and design are our own work. You are welcome to use it here for free, but please do not copy, republish or sell it. Terms of use
Missing a feature, found a bug, or something confusing? Tell us in a line.
About this game
Play the Tower of Hanoi puzzle free in your browser. Move the whole stack of disks from the left rod to the right rod, one disk at a time, without ever putting a bigger disk on a smaller one. Choose 3 to 8 disks, try to finish in the fewest moves, or watch the solver do it.
Quick answer: Click a rod to pick up its top disk, then click another rod to drop it there (or press keys 1, 2 and 3). Only one disk moves at a time, and a disk can never sit on a smaller one. Move the full tower to the right-hand rod to win. The smallest possible number of moves is 2n − 1, where n is the number of disks.
How to solve the Tower of Hanoi
- To move a tower of n disks, first move the top n − 1 disks out of the way onto the spare rod.
- Move the biggest disk to the target rod.
- Move the n − 1 disks from the spare rod on top of it.
- Each smaller tower is solved the same way, which is why the puzzle is a classic example of recursion.
A handy pattern: move the smallest disk every other turn, always in the same direction (to the right with an odd number of disks, to the left with an even number, wrapping around), and in between make the only other legal move.
Minimum moves for each Tower of Hanoi size
| Disks | Minimum moves |
|---|---|
| 3 | 7 |
| 4 | 15 |
| 5 | 31 |
| 6 | 63 |
| 7 | 127 |
| 8 | 255 |
The puzzle was invented by the French mathematician Édouard Lucas in 1883. A legend he told says monks are moving 64 golden disks; at one move per second, that would take about 585 billion years.
More brain games: sliding puzzle, peg solitaire and dots and boxes.
FAQ
Is the Tower of Hanoi good for kids?
Yes. Start with 3 disks, which takes just 7 moves, then add a disk once it feels easy. It builds planning and step-by-step thinking.
Why is the puzzle used in computer science?
Its solution breaks a big problem into the same problem at a smaller size, which makes it a favorite first example of recursive algorithms.

$4.99Free when you subscribe
Get 100 tech terms explained in plain English
8-page PDF on AI, coding, slang and SEO + one tech email a week.
Don’t want emails? Buy the PDF for $4.99 (opens in a new tab)
Sent by email. Unsubscribe anytime. See our privacy policy.





