Skip to content

Tower of Hanoi with 8 Disks

The shortest solution is 255 moves. Play them on the board, or read every one in the list under it.

Optimal solution

255moves2⁸ − 1

First move
Disk 1, A → B
At one move a second
4 minutes
Difficulty
Hard

8 disks on tower A. 255 moves to go.Step 0 of 255

Every move of the 8-disk solution
MoveDiskFromTo
11AB
22AC
31BC
43AB
51CA
62CB
71AB
84AC
91BC
102BA
111CA
123BC
131AB
142AC
151BC
165AB
171CA
182CB
191AB
203CA
211BC
222BA
231CA
244CB
251AB
262AC
271BC
283AB
291CA
302CB
311AB
326AC
331BC
342BA
351CA
363BC
371AB
382AC
391BC
404BA
411CA
422CB
431AB
443CA
451BC
462BA
471CA
485BC
491AB
502AC
511BC
523AB
531CA
542CB
551AB
564AC
571BC
582BA
591CA
603BC
611AB
622AC
631BC
647AB
651CA
662CB
671AB
683CA
691BC
702BA
711CA
724CB
731AB
742AC
751BC
763AB
771CA
782CB
791AB
805CA
811BC
822BA
831CA
843BC
851AB
862AC
871BC
884BA
891CA
902CB
911AB
923CA
931BC
942BA
951CA
966CB
971AB
982AC
991BC
1003AB
1011CA
1022CB
1031AB
1044AC
1051BC
1062BA
1071CA
1083BC
1091AB
1102AC
1111BC
1125AB
1131CA
1142CB
1151AB
1163CA
1171BC
1182BA
1191CA
1204CB
1211AB
1222AC
1231BC
1243AB
1251CA
1262CB
1271AB
1288AC
1291BC
1302BA
1311CA
1323BC
1331AB
1342AC
1351BC
1364BA
1371CA
1382CB
1391AB
1403CA
1411BC
1422BA
1431CA
1445BC
1451AB
1462AC
1471BC
1483AB
1491CA
1502CB
1511AB
1524AC
1531BC
1542BA
1551CA
1563BC
1571AB
1582AC
1591BC
1606BA
1611CA
1622CB
1631AB
1643CA
1651BC
1662BA
1671CA
1684CB
1691AB
1702AC
1711BC
1723AB
1731CA
1742CB
1751AB
1765CA
1771BC
1782BA
1791CA
1803BC
1811AB
1822AC
1831BC
1844BA
1851CA
1862CB
1871AB
1883CA
1891BC
1902BA
1911CA
1927BC
1931AB
1942AC
1951BC
1963AB
1971CA
1982CB
1991AB
2004AC
2011BC
2022BA
2031CA
2043BC
2051AB
2062AC
2071BC
2085AB
2091CA
2102CB
2111AB
2123CA
2131BC
2142BA
2151CA
2164CB
2171AB
2182AC
2191BC
2203AB
2211CA
2222CB
2231AB
2246AC
2251BC
2262BA
2271CA
2283BC
2291AB
2302AC
2311BC
2324BA
2331CA
2342CB
2351AB
2363CA
2371BC
2382BA
2391CA
2405BC
2411AB
2422AC
2431BC
2443AB
2451CA
2462CB
2471AB
2484AC
2491BC
2502BA
2511CA
2523BC
2531AB
2542AC
2551BC
On this page
  1. The solution
  2. The shape of the solution
  3. Which disk moves when
  4. The smallest disk's circuit
  5. About the 8-disk puzzle
  6. Other sizes
  7. Frequently asked questions

The shape of the solution

There are never 255 separate moves to remember — only three stages:

  1. Moves 1 to 127: build a tower of 7 disks on B.
  2. Move 128: disk 8 crosses to C — the only time it moves.
  3. Moves 129 to 255: rebuild the 7-disk tower on top of it.

Stages 1 and 3 are each the 7-disk solution, with two towers' names swapped.

Which disk moves when

Disk 1 makes half of all the moves — 128 of them, on every odd-numbered move. Each larger disk moves half as often as the one above it, which is the binary counter hiding inside the puzzle: the disk that moves is one more than the number of times you can halve the move number and still get a whole number. Move 6 halves once, to 3, so move 6 is disk 2. There is more on that in Tower of Hanoi and binary.

DiskMovesFirst moves onThen every
1128move 12 moves
264move 24 moves
332move 48 moves
416move 816 moves
58move 1632 moves
64move 3264 moves
72move 64128 moves
81move 128

The smallest disk's circuit

With 8 disks — an even number — disk 1 travels A → B → C → A for the whole game, never reversing. Every move in between is the only legal move that leaves disk 1 alone. Those two rules alone reproduce the list above move for move; the iterative solution explains why, and strategies turns it into something to play by.

About the 8-disk puzzle

Eight disks is the original. When Édouard Lucas put the puzzle on sale in 1883 as La Tour d’Hanoï, the tower in the box had eight wooden disks, so a perfect game of the first Tower of Hanoi anyone bought took 255 moves — the number on this page. The sixty-four golden disks came later, in the legend written up for it; the eight wooden ones are what people actually played. There is more in the history of the puzzle.

255 in binary is 11111111: eight ones, one for each disk, and the largest value a single byte can hold. The match is not a coincidence of this size. Count the moves in binary from 1 to 255 and, on every move, the disk that moves is the position of the lowest 1 bit — so the whole solution is a byte counting up. Tower of Hanoi and binary plays that counter beside a board.

Eight is even, so disk 1 starts toward B. The count factors as 3 × 5 × 17, and the game is Hard on this board, a little over four minutes at a move a second.

Other sizes

Frequently asked questions

How many moves does it take to solve Tower of Hanoi with 8 disks?

255 moves is the minimum: 2⁸ − 1 = 255. No solution with fewer moves exists, and any solution with more has wasted some.

What is the first move in 8-disk Tower of Hanoi?

Move disk 1, the smallest, from tower A to tower B. With an even number of disks the smallest disk travels A → B → C → A for the whole game, so its first stop is B. Sending it to C first still lets you finish, but it costs one extra move.

How long does 8-disk Tower of Hanoi take to solve?

A perfect game is 255 moves, which at one move a second is 4 minutes and at three moves a second — about as fast as anyone plays by hand — 1 minute.

How many disks did the original Tower of Hanoi have?

Eight. The puzzle Édouard Lucas sold in 1883 as La Tour d'Hanoï was a tower of eight wooden disks on three pegs, so a perfect game of the original took 255 moves. The legend published about it a year later described sixty-four disks of gold, but nobody was ever sold those.