TOWER OF HANOI
Tower of Hanoi, the optimal count, at a glance.
Choose the number of discs, see the optimal 2^n-1 moves, and play manually or automatically. Runs locally in your browser.
Board
Settings & stats
Rules
Move one disc at a time and never place a larger disc on a smaller one. The goal is to move the whole stack to the rightmost peg; the minimum is 2^n-1 moves for n discs — the classic divide-and-conquer problem.
Everything runs locally in your browser
What can this tool do?
Choose 1 to 12 discs and the page shows the optimal move count 2^n-1 for that size (3 discs = 7 moves, 10 discs = 1023), making the exponential growth tangible. Play manually by clicking a source peg then a target peg, with a running timer; or hit Auto solve to watch the divide-and-conquer algorithm run, or Next move to step through. When finished, your moves are compared against the optimum for an efficiency rating. Everything runs locally.
FAQ
Why is the move count 2^n-1?
To move n discs from A to C you must first move the top n-1 to B (2^(n-1)-1 moves), then the largest disc to C (1 move), then the n-1 from B to C (another 2^(n-1)-1). Summing gives 2^n-1 — the classic divide-and-conquer recurrence.
Why not allow more discs?
Moves grow exponentially: 12 discs already needs 4095 moves, far too long to watch step by step. The limit of 12 keeps it useful for observing the pattern rather than completing a challenge.