Skip to content

Learn

How to Play Tower of Hanoi

Three rules, one goal. Read them, see them, then try them on a three-disk board right here on the page.

On this page
  1. Objective
  2. The Three Rules
  3. How to Move a Disk
  4. Try It: Three Disks
  5. Example: the Three-Disk Game
  6. How to Win
  7. Minimum Number of Moves
  8. Where to Go Next
  9. Frequently Asked Questions

Tower of Hanoi is a puzzle of three towers and a stack of disks, each a different size. The French mathematician Édouard Lucas published it in 1883. It takes about a minute to learn, and this page is that minute.

Objective

You start with every disk stacked on the left tower, A, largest at the bottom and smallest on top. Your goal is to rebuild that exact stack on the right tower, C.

The middle tower, B, is not decoration — it is working space. Every game with more than one disk has to park disks there on the way.

Start. Every disk is on tower A, largest at the bottom. Only disk 1 is on top of its tower, so at this moment it is the only disk in the game that can move.

Goal. The same stack, in the same order, on tower C. Tower B is empty again — it was only ever working space.

A, B, C
The three towers, left to right. The letters are printed under the towers on the board, and every move list on this site uses them.
Disk 1
The smallest disk. Numbers grow with size, so on a five-disk board disk 5 is the largest one at the bottom.
A → C
One move: take the top disk off tower A and put it on tower C. Move lists often add the disk number too, as the one below does, but the two letters are enough on their own — only one disk on a tower can ever be the one that moves.

The Three Rules

  1. Move one disk at a time.
  2. Only the top disk of a tower can move. Disks buried under others are locked in place until they are uncovered.
  3. A larger disk may never rest on a smaller one. A disk can go onto an empty tower or onto a bigger disk, and nowhere else.
  • AllowedDisk 2 onto disk 3. The disk you are carrying is smaller than the one it lands on, so the stack stays in order. Dropping onto a completely empty tower is always allowed too.

  • Not allowedDisk 3 onto disk 1. The disk you are carrying is larger than the one it would land on. The board refuses the move, says why, and puts the disk back where it came from — nothing is lost.

The only rule you can try to break — the board refuses the move. The other two, one disk at a time and top disk only, it will not even let you attempt.

That is the whole rulebook. There is no rule against moving the same disk twice in a row, no time limit and no limit on moves — you cannot lose. The only pressure is your own move count.

How to Move a Disk

A move is two actions: lift a disk, then drop it on another tower. The board gives you three ways to do that.

  • Tap or click. Tap a tower to lift its top disk. The disk rises to show it is in your hand, and the towers it can legally go to light up. Tap the destination to drop it, or tap the same tower again to put the disk back.
  • Drag. With a mouse or trackpad, press on a tower and drag the disk to another one; the tower under the pointer shows whether it will take the disk. On a phone, tap instead — a finger would cover the very disk it was dragging.
  • Keyboard. Tab to the board, then press1, 2 or3 to lift from and drop on towers A, B and C. Or use the arrow keys: to choose a tower, to lift and to drop. Esc puts the disk back.

If the destination holds a smaller disk, the move is refused: the tower flashes, the disk goes back to the tower it came from, and a short message says why. A refused move does not count.

Try It: Three Disks

This board plays by exactly the same rules as the real one. Try to break rule three — put a bigger disk on a smaller one — and see what happens. Then finish the game.

Tap a tower to lift its top disk.

That is the whole game.Play Tower of Hanoi with more disks →

A practice board with no timer and no score. Nothing you do here is saved.

Example: the Three-Disk Game

Three disks take seven moves. Press play, or step through them one at a time; the table follows the board, and clicking a row jumps straight to that move. Disk 1 is the smallest, disk 3 the largest.

Three disks on tower A. Seven moves to go.Step 0 of 7

The seven moves of a three-disk game
MoveDiskFromTo
11AC
22AB
31CB
43AC
51BA
62BC
71AC
Moves 1–3 build a two-disk stack on B. Move 4 is the only time the largest disk moves: once, straight from A to C. Moves 5–7 are the same three-move pattern again, carrying the two-disk stack from B onto C. Open these moves in the solver →

How to Win

You win the moment every disk sits on tower C in the original order. The board counts your moves as you go, and saves your best result for each disk count in your browser.

  • Hint only points at the next move — you still make it, so a hinted game can still set a best score.
  • Step and Auto Solve make moves for you. The game still finishes, but it won't overwrite your best score.

Minimum Number of Moves

A perfect game of n disks takes 2ⁿ − 1 moves, and no solution is shorter. Every disk you add doubles the length of the game, plus one move.

DisksMinimum moves
37
415
531
663
7127
8255

The board goes up to 15 disks, which is 32,767 moves. For any other size, up to the sixty-four disks of the original legend, use the minimum moves calculator.

Where to Go Next

  • Play Tower of Hanoi — start at three disks, win once, then add one.
  • Tower of Hanoi strategies — the one idea that solves every size, and the shortcut for knowing your next move.
  • Tower of Hanoi solver — stuck halfway through a game? Tell it where your disks are and get every remaining move.
  • Minimum moves calculator — the move count and the time it takes, for any number of disks.
  • Teaching it — a 45-minute lesson plan with timings, a worksheet to print, and instructions for building a set out of cardboard.

Frequently Asked Questions

Why won't the board let me make a move?

Only two moves are refused. Tapping an empty tower first is refused, because there is no disk to pick up. Dropping a disk onto a smaller one is refused too, and the board puts the disk back where it came from. Either way the board says why, and neither counts as a move.

Do I have to use the middle tower?

Yes, in every game with more than one disk. The largest disk can only reach tower C once every smaller disk is off it and none of them is sitting on C — and the only place left for them is tower B. The middle tower is not a detour; it is where most of the game happens.

How many disks should I start with?

Three. That is seven moves, small enough to see the whole pattern at once. Set the disk count to three for your first game, then add one disk each time you win — every disk you add roughly doubles the length of the game.

Can I move a disk straight back to where it came from?

Yes. Nothing in the rules forbids it, and the board will let you. It costs two moves and leaves the board exactly as it was, though, so in a game you are trying to finish efficiently it is always a wasted pair.

Have I lost if I take more than the minimum number of moves?

No. You win the moment every disk is on tower C, however many moves it took. The minimum — 2ⁿ − 1, which is 7 for three disks — is a score to aim at, not a condition of winning.