Skip to content
KBHXgamesAll games

Play Tower of Hanoi Online

Rebuild a ring stack on the right peg one ring at a time, never putting a big ring on a small one.

Tower of Hanoi gameplay screenshot
  • Touch-ready

Tower of Hanoi at a glance

Genre
Puzzle Games
Play with
Keyboard, Mouse, Touch screen
On phones
Yes, touch works
Players
1 player
Price
Free, no sign-up
License
MIT

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

  1. Select a peg to lift its top ring. The ring floats above the selected peg.
  2. Move to another peg and drop it there.
  3. The drop is only allowed on an empty peg or on a larger ring.
  4. Every drop counts as one move, shown in the top right as moves made over the minimum, such as 9/7.
  5. 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

Keyboard, mouse and touch controls for Tower of Hanoi
What you do⌨ Keyboard🖱 Mouse👆 Touch
Pick up or drop a ringSpace, Enter, Up/Down arrows, or W/SClick a pegTap a peg
Move the selection between pegsLeft/Right arrows or A/D——
Restart the puzzleRClick the circular arrows iconTap the circular arrows icon
Add or remove a ring—Click the plus or minus iconTap 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

Tower of Hanoi: Questions and Answers

Is Tower of Hanoi free to play here?

Yes. It is free in your browser on a computer or phone, with no download. Start with three rings and add more with the plus icon whenever you want a longer puzzle.

What is the minimum number of moves?

For n rings it is two to the power of n, minus one. Three rings take 7 moves, four take 15, and five take 31. The counter shows this target after the slash.

Does dropping a ring back on the same peg count?

Yes. Every drop adds one to the counter, even if the ring goes right back where it came from. Decide where a ring is going before you lift it.

Can I take over from the auto-solver?

Not mid-solve. Pressing play again stops it, but the next run starts from the beginning. Watch it to learn the rhythm, then restart and try on your own.

If You Liked Tower of Hanoi, Try These