Tower of Hanoi

Move the whole tower to the right hand peg.

Example

Example

Unscored example

Pick a peg, then a destination. Smaller disks go on top.

Pick a peg, then a destination. Smaller disks go on top.

An example to explore. No score or practice round is recorded.

Three disks, stacked on the left peg. Seven moves is the fewest it can take.

1 puzzle · The clock starts on your first move

Move the tower to the right hand peg

Press the top disk of a peg and drag it along the row of pegs.

Help

Three pegs stand on a plank with a stack of disks on one of them. Move one disk at a time. A bigger disk can never sit on a smaller one. The deal is solved when every disk is on the right hand peg, the one with a ring worn into the wood.

Press the top disk of a peg and drag it along the row of pegs. Let go past a third of the way to the next peg and the disk moves there. Let go sooner and it goes back. You can also tap a disk and then tap the peg you want. A disk with only one legal peg goes there on the first tap. A peg that cannot take the disk goes pale while you hold it. Let go over that peg and the disk goes back where it was and turns red for a moment.

Three, four, five, six and seven disks all start as a tower on the left peg, and each one takes twice the moves of the level before it plus one. Scrambled deals five disks across the three pegs and always well away from home, so the fewest is different every time.

The page works out the fewest moves before the clock starts. It measures the distance from every position this puzzle can reach to the finished tower, so the number is exact and not a guess. The line under the board counts how far the board is from home while you play.

Hint makes one move for you. It picks a move that leads home in the fewest steps, and it says which disk went where. It counts as one of your moves. The round records how many hints you used. A deal played with a hint is saved to your statistics and counts as solved there. It is left out of the solving time and out of the community comparison.

The result is the moves you made against the fewest this deal could take, with the hints and the time. Undo takes a move back, and the move count goes down with it, so the number at the end is the moves standing on the board. The clock starts on your first move and stops when the last disk lands.

The score says how well you solved this deal. It is not a speed record, and it says nothing about any other puzzle. A deal you leave before it is solved is not saved.

The statistics page compares deals at the same level. Every saved deal is a solved one, so what it shows is the moves you made and the time you took.

To move a tower, move the smaller tower above the biggest disk first. Learn how the tower comes apart

Share practice

Share this practice

Tower of Hanoi

View history Report

Keyboard shortcuts

Enter
Start or continue
?
Keyboard shortcuts
Esc
Close help or notes

Each practice may show additional keys.

Tab moves between controls. Enter or Space activates the focused control. Shortcuts pause while typing or viewing help.

About this practice

Move the whole tower to the right hand peg. One disk at a time, and never a bigger disk on a smaller one.

Report a problem

Sign in free

Practice without limits and keep your progress.