Tower of Hanoi is the classic peg-and-ring puzzle drawn on a simple black canvas. Three pegs stand side by side, and a stack of rings starts on the left one, largest at the bottom. Your job is to rebuild the stack on the right-hand peg. This version by Douile shows your move count next to the smallest possible total, lets you raise the number of rings, and can play out the perfect solution for you to watch.
How to Play Tower of Hanoi
You move one ring at a time. Lift the top ring from any peg, carry it over another peg, and set it down. A ring can only land on an empty peg or on a ring that is larger than itself. The held ring floats above the peg you have selected, so you always see where it will go.
The game starts with three rings, which can be solved in seven moves. The plus icon adds a ring and the minus icon removes one, down to a minimum of three. Changing the count starts a fresh puzzle.
The counter at the top right reads moves made over the best possible total, such as 9/7. When the last ring lands on the right peg, the board briefly zooms in and back out to mark the finish. Try to match the minimum, then add another ring.
Tower of Hanoi Controls
| Action | 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) |
Tips and Strategies
- Count the rings first. With an odd number of rings, the smallest ring’s first move goes to the right peg. With an even number, it goes to the middle peg.
- Move the smallest ring every other turn. Every second move in a perfect solution is the smallest ring, and it always travels around the pegs in the same direction.
- Between those turns, there is only one legal move. When the smallest ring stays put, exactly one other move is allowed, so take it.
- Think in sub-stacks. To move five rings, first park the top four on the middle peg, shift the big ring, then rebuild the four on top of it.
- Watch the solver once. Running the auto-solve on four or five rings makes the repeating rhythm easy to see.
Features
- Live move counter: your moves are shown beside the minimum for the current stack.
- Adjustable size: add rings for a longer challenge or drop back to three.
- Built-in solver: watch the optimal sequence play out at a steady pace.
- Keyboard or pointer: use the arrow keys and Space, or simply click and tap the pegs.
Tested and updated:













