Move all disks from the source peg to the target peg — one disk at a time, never placing a larger disk on a smaller one. Achieve the minimum possible moves to earn a perfect score. Free brain training, no download needed.
Sequence complete!
Click or tap any disk on top of a peg to lift it. Only the top disk on each peg can be selected.
Click the destination peg to place the disk. You can never place a larger disk on top of a smaller one.
Move all disks to the TARGET peg (rightmost). For N disks, the minimum moves needed is 2ⁿ − 1.
Made a mistake? Use the UNDO button to step back one move. Unlimited undos — but they count toward your total.
Watch the AI solve the puzzle using the optimal recursive algorithm. Great for learning the strategy.
Solve in exactly 2ⁿ − 1 moves to earn a Perfect Solve badge. These are counted separately in your stats.
| Disks | Min Moves | Label | Formula |
|---|---|---|---|
| 3 | 7 | Quick | 2³ − 1 |
| 4 | 15 | Normal | 2⁴ − 1 |
| 5 | 31 | Tough | 2⁵ − 1 |
| 6 | 63 | Expert | 2⁶ − 1 |
| 7 | 127 | Genius | 2⁷ − 1 |
Tower of Hanoi is a classic math puzzle invented in 1883. Move all disks from peg 1 to peg 3, one at a time, never placing a larger disk on a smaller one. The minimum solution takes 2ⁿ − 1 moves for n disks.
Minimum moves = 2ⁿ − 1. For 3 disks: 7 moves. 4 disks: 15. 5 disks: 31. 6 disks: 63. 7 disks: 127. The game shows your overhead vs the optimal in real time.
Auto-solve uses the classic recursive algorithm to solve the puzzle optimally. Watch it animate step by step — great for learning the strategy. Speed adjusts based on disk count.
100% free, no ads, no account needed. Your leaderboard, best score, perfect solves and games played are all saved in your browser's localStorage. Return any time and your records will be there.