Tower of Hanoi Unblocked

Rebuild the stack on the far peg, moving single rings and keeping small ones on top of larger ones.

Tower of Hanoi is a famous logic puzzle built from three pegs and a pile of rings. The rings start on the left peg, biggest at the bottom, and you have to rebuild the same stack on the right peg. Play Tower of Hanoi unblocked in your browser and you will soon meet the one rule that makes it tricky: a larger ring can never sit on a smaller one. This version by Douile draws everything on a plain black canvas, compares your moves with the best possible score, and can even solve itself while you watch.

How to Play Tower of Hanoi

There are only two rules:

  1. Each move shifts a single ring, and it has to be the topmost one on its peg.
  2. A ring can rest on a bare peg or on a bigger ring, but never on a smaller one.

You win when every ring sits on the right peg in the original order. If you try to drop a ring on a smaller one, nothing happens and the ring stays in your hand, so you cannot break the rule by accident. Find a legal peg and drop it there.

The rings are colored from bright green for the smallest to yellow for the largest, so you can judge sizes at a glance. The ring you are about to lift has a red outline. Once you lift it, it floats in green above the chosen peg so you always know where it will land.

Your First Solve With Three Rings

A new game starts with three rings. Here is the perfect seven-move solution, using left, middle and right for the pegs:

  1. Small ring to the right.
  2. Middle ring to the middle peg.
  3. Small ring onto the middle peg.
  4. Big ring to the right. The hardest part is done.
  5. Small ring back to the left.
  6. Middle ring onto the big ring on the right.
  7. Small ring to the right.

Try it once by following the list, then do it again from memory. When the stack lands, the board does a quick zoom, and the counter shows 7/7.

Moves, Rings and the Counter

The counter in the top-right corner looks like a fraction, such as 9/7. The first number is how many moves you have made and the second is the minimum possible. Every drop counts, even setting a ring back where it came from.

Use the plus icon in the bottom corner for a taller stack, or the minus icon for a shorter one. Three is the lowest you can go, and there is no hard top limit, so you can keep adding rings as long as you like. Each change, like the restart icon or the R key, sets up a fresh puzzle.

The minimum grows fast, because each extra ring roughly doubles it:

  • 3 rings: 7 moves
  • 4 rings: 15 moves
  • 5 rings: 31 moves
  • 6 rings: 63 moves
  • 7 rings: 127 moves
  • 10 rings: 1,023 moves

Tower of Hanoi Strategy and Pattern

The puzzle has a neat rhythm once you see it:

  • Odd or even decides move one. If the ring count is odd, the smallest ring goes to the right peg first. If it is even, send it to the middle peg instead.
  • The smallest ring moves every other turn. It always travels around the three pegs in the same direction.
  • The turn in between has only one choice. When the small ring rests, exactly one other legal move exists that does not involve it, so make that move.
  • Think in smaller stacks. Moving five rings really means moving the top four out of the way, then the biggest ring, then those four again on top of it.
  • Aim for the biggest ring. Your real goal is to clear a path for the bottom ring to reach the right peg in one move. Everything before that is setup.

Mistakes New Players Make

The most common one is starting the small ring on the wrong peg. With an even number of rings, sending it right first makes the perfect score impossible. If your count is already above the minimum early on, press R and start over.

Another is lifting a ring and then putting it back. That costs a move and gets you nothing. Plan the next two or three moves before you touch anything. Last, many players jump from three rings straight to six. Work up one ring at a time so the pattern sticks.

Learning From the Auto-Solver

The play icon runs the perfect solution at about ten moves per second. Try it with four or five rings and watch how the smallest ring loops around. Press the icon again to pause the solver mid-way, then finish the puzzle yourself from that position. Pressing play again restarts the solution from a fresh stack.

Seven rings take the solver just under 13 seconds. It is a good way to see why the minimum doubles, since each larger stack is two copies of the smaller solve joined by one big move.

Playing on a Chromebook or Phone

On a keyboard, use the left and right arrows or A and D to choose a peg, and Space, Enter, the Up or Down arrow, W or S to lift and drop. When you are not holding a ring, the selection skips empty pegs. With a mouse or a touch screen, click or tap a peg to lift its top ring, then tap another peg to drop it.

The canvas resizes to fit the window, so it works on a Chromebook and on phones in either direction. Landscape gives the rings more width when the stack gets tall. There is no sound and nothing to install.

Similar Puzzles on Totally Science

Tower of Hanoi is a short brain workout that suits a five-minute break, or a longer session if you chase a perfect seven-ring solve. If you like it, try 15 Puzzle, which also rewards planning ahead, but with sliding tiles. Light Flip is another pattern puzzle where each move changes several things at once. For number logic, Number Trail is a good next step. Browse more on the puzzle games page.

Quick facts

Category
Puzzle Games
Devices
Phone, tablet & computer
Controls
Keyboard, Mouse, Touch
Players
1 player
Price
Free, no sign-up
  • logic
  • puzzle
  • math
  • rings
  • brain teaser

How to control Tower of Hanoi

ActionKeyboardMouseTouch
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)

Made by

Douile

Code license
MIT
Art & sound
MIT (rings and pegs drawn in code; Feather icons, MIT)

Tower of Hanoi questions

What is the smallest possible move count?

It is shown after the slash in the counter. The formula is 2 to the power of the ring count, minus one, so three rings take 7 moves, four take 15 and five take 31.

How do you win Tower of Hanoi?

Move every ring from the left peg to the right peg, one at a time, without ever setting a ring on a smaller one. The game zooms in briefly when the full stack lands on the right peg.

Does putting a ring back on the same peg count?

Yes. Each drop adds one to the count, including a drop back onto the starting peg. Think before you lift.

Can I stop the auto-solver and take over?

Yes. Press the play icon again to pause it, and you can keep playing by hand from that exact spot. Pressing play a second time starts the solution over from a fresh stack.

Can I play Tower of Hanoi on a Chromebook or phone?

Yes. Use the arrow keys and Space on a Chromebook, or tap a peg to lift its top ring and tap another peg to drop it on a phone or tablet.

Does Tower of Hanoi save my progress?

No. The puzzle is not stored, so a reload brings back a fresh three-ring stack. Each round is short, so you can start again in seconds.

More puzzle games

See all →