Tower of Hanoi
Move the whole disk tower to Peg 3, one disk at a time.
Click a peg to lift its top disk, then click another peg to place it.
Rule: never place a larger disk on top of a smaller one. Move the full tower from Peg 1 to Peg 3.
About Tower of Hanoi
The Tower of Hanoi is a puzzle with a legend attached: monks in a distant temple are said to be moving 64 golden disks between pegs, and when the last disk falls into place, the world ends. The good news for everyone is that 64 disks need more than 18 quintillion moves, so the end is not near. Your version is more merciful ā a stack of coloured disks, three pegs, and one iron rule: a larger disk may never rest on top of a smaller one.
You choose the challenge, from 3 disks up to 7. The catch is exponential: the perfect solution takes 2āæ ā 1 moves, so 3 disks need just 7 moves, 5 disks need 31, and the full 7-disk tower needs a flawless 127. Your move counter runs beside the perfect figure the whole game, turning every solve into a personal efficiency contest ā finishing in 40 moves on a 5-disk tower is a win, but it begs the question of where the 9 spare moves went.
The puzzle's real gift is the pattern it teaches. The solution is recursive: to move a tower of n disks, move the top nā1 out of the way, move the biggest disk once, then rebuild. Once you feel that rhythm ā and the smaller secret that the smallest disk moves on every second turn, always in the same rotational direction ā the tower stops being a maze and becomes a dance you can perform at any size.
How to Play Tower of Hanoi
Pick your challenge with the Disks selector: 3, 4, 5, 6 or 7 disks. The whole stack starts on Peg 1, largest at the bottom, and the perfect move count for that size is shown on screen.
Click a peg to lift its top disk ā it rises and highlights to show it is in your hand.
Click a different peg to set the disk down. If that peg's top disk is smaller than yours, the move is illegal and is rejected with a message; click the original peg instead if you change your mind.
Only one disk moves at a time, and you can never park a bigger disk on a smaller one, so freeing the biggest disk means first building the entire smaller tower somewhere else.
Keep transferring the stack, using the middle peg as working space, until the complete tower stands on Peg 3.
The puzzle is solved the moment Peg 3 holds all the disks. Your final move count is compared with the perfect 2āæ ā 1 ā Reset and try to match it.
Controls
Tips & Tricks
- š”Think recursively: to free the biggest disk, first move the whole tower above it onto a single spare peg. Solve that smaller tower the same way ā it breaks the puzzle into copies of itself.
- š”Make the first move count. With an odd number of disks, move the smallest disk straight to Peg 3; with an even number, move it to Peg 2. This sets up the perfect solution from move one.
- š”The smallest disk moves on every other turn, always cycling in the same direction (Peg 1 ā 3 ā 2 ā 1 for odd towers). Between its moves, there is only ever one legal move that does not involve it ā make that one.
- š”Chasing the perfect score? Never move the same disk twice in a row (other than the smallest in its rhythm) and never undo a move ā every spare move in your count is a disk that travelled somewhere it did not need to go.
Tower of Hanoi ā Frequently Asked Questions
What is the minimum number of moves for each size?+
The perfect solution is always 2āæ ā 1: 7 moves for 3 disks, 15 for 4, 31 for 5, 63 for 6 and 127 for 7. The game displays the target for your chosen size next to your live move counter.
Does the tower have to end on Peg 3 specifically?+
Yes. Building the complete tower on Peg 2 is a nice tower but not a solve ā the win is only registered when all disks sit on Peg 3 in the correct order.
What happens if I try an illegal move?+
Nothing bad ā the move is simply refused with a message explaining that a bigger disk cannot sit on a smaller one. Your move counter does not increase for rejected moves, so experimenting is free.
Is there a timer?+
No. Tower of Hanoi here is scored purely on move efficiency against the perfect count, so you can think as long as you like between moves.
More Games Like This
Browse all 2D games āMinesweeper
Clear the minefield without detonating any mines!
Memory Card Match
Flip cards and find matching pairs. Train your memory!
2048
Slide tiles and combine them to reach the 2048 tile.
Sudoku
Fill the 9Ć9 grid so every row, column, and box has 1-9.
All games on Vimzify are free to play in your browser ā no downloads, no sign-up. Game page: https://vimzify.com/games/tower-of-hanoi