Tower of Hanoi is a famous logic puzzle built from three pegs and a stack of rings. It looks easy with three rings, but every added ring doubles the work, and the clean pattern behind it is fun to discover. This simple version shows your move count beside the best possible total, lets you change the stack size, and can even solve itself while you watch.
The Goal
Move the whole stack from the left peg to the right peg. The rings start in order, with the largest at the bottom. You may only move one ring at a time, and a ring can never sit on top of a smaller one. Try to finish in the fewest moves possible.
Rules Explained
- Select a peg to lift its top ring. The ring floats above the selected peg.
- Move to another peg and drop it there.
- The drop is only allowed on an empty peg or on a larger ring.
- Every drop counts as one move, shown in the top right as moves made over the minimum, such as 9/7.
- When the last ring lands on the right peg, the board zooms in and out to mark the win.
The puzzle starts with three rings. The plus and minus icons change the count, with three as the lowest, and any change starts a fresh puzzle.
Keys and Buttons for Tower of Hanoi
| What you do | ⌨ Keyboard | 🖱 Mouse | 👆 Touch |
|---|---|---|---|
| Pick up or drop a ring | Space, Enter, Up/Down arrows, or W/S | Click a peg | Tap a peg |
| Move the selection between pegs | Left/Right arrows or A/D | — | — |
| Restart the puzzle | R | Click the circular arrows icon | Tap the circular arrows icon |
| Add or remove a ring | — | Click the plus or minus icon | Tap the plus or minus icon |
| Watch the puzzle solve itself | — | Click the play icon (click again to stop) | Tap the play icon (tap again to stop) |
Winning Strategies
- Check odd or even first. With an odd number of rings, move the smallest ring to the right peg first. With an even number, send it to the middle.
- Alternate with the smallest ring. In a perfect solve, every other move is the smallest ring, and it always cycles around the pegs in the same direction.
- Take the only other move. When you are not moving the smallest ring, there is just one legal move left. Make it.
- Break it into smaller stacks. To move five rings, move the top four to the middle, shift the largest, then rebuild the four on top.
- Watch the solver once. Running it on four or five rings makes the repeating pattern easy to spot.
Common Mistakes
- Lifting a ring without a plan and dropping it back, which still costs a move.
- Moving the smallest ring in both directions instead of one steady cycle.
Who Should Play It
Tower of Hanoi suits students, math fans and anyone who likes finding the pattern behind a puzzle. If you enjoy sliding block puzzles or other classic brain teasers, see how many rings you can solve perfectly.
Played and checked by the KBHX Games team · updated











