About Tower of Hanoi
Three pegs, a stack of colorful rings and one strict rule: a bigger ring can never sit on top of a smaller one. Tower of Hanoi is a centuries-old logic puzzle, and this version challenges you to move the full stack from the left peg over to the right. It's easy to learn and surprisingly tricky to do well.
You carry one ring at a time, and a counter shows your moves next to the lowest possible total, so you always know how close you are to a perfect solve. It begins with three rings, but you can add more for a much longer puzzle. Stuck? A built-in solver plays out the ideal sequence so you can watch the pattern and then try it yourself.
How to play Tower of Hanoi
- Choose a peg to pick up the ring on top.
- Move to another peg and drop the ring there.
- Set rings down only on bare pegs or on rings bigger than themselves.
- Rebuild the complete tower on the far right peg.
- Try to match the minimum move count, then add another ring.
Tower of Hanoi controls
| Input | Action |
|---|---|
| Left / Right arrows or A / D | Choose a peg |
| Space / Enter / Up / Down | Pick up or drop a ring |
| R | Restart |
| Left click | Pick up or drop on a peg |
| Tap | Pick up or drop on a peg |
How to play Tower of Hanoi on PC and mobile
On PC, laptop or Chromebook
- Press Play on this page – the game loads right here, with nothing to download.
- Click Fullscreen under the game for the biggest view. Press Esc to exit.
- Click once inside the game so it receives your keyboard input.
- Controls: Left / Right arrows or A / D choose a peg; Space / Enter / Up / Down pick up or drop a ring; R restart; Left click pick up or drop on a peg.
On phone or tablet
- Open this page in Chrome or Safari and tap Play.
- Turn your device to landscape – the game is designed for a wide screen.
- Touch controls: Tap to pick up or drop on a peg.
- Tap Fullscreen to hide the browser bars.
Tips and tricks
- If the ring count is odd, send the smallest ring to the right peg first; if it's even, send it to the middle.
- In a perfect solve, the smallest ring moves every other turn, always circling the same way.
- On turns when you aren't moving the smallest ring, only one other legal move exists, so make it.
- Run the solver once on four or five rings to see the rhythm clearly.
Tower of Hanoi FAQ
What's the fewest number of moves?
Does dropping a ring back on the same peg count?
How do I change the number of rings?
Can I play Tower of Hanoi for free?
Does Tower of Hanoi work on Chromebook and mobile?
Who made Tower of Hanoi?
Credits and license
- Original game
- Towers of Hanoi
- Made by
- Douile
- Source code
- github.com/Douile/tower-of-hanoi
- Code license
- MIT
- Art and sound
- MIT (rings and pegs drawn in code; Feather icons, MIT)
Tower of Hanoi runs from this site with small changes, which are listed in “What we changed”. The original license and credits are kept with the game files.