Skip to main content
Z

Tower of Hanoi Visualizer — Recursive Solver

Animated recursive Tower of Hanoi solver — moves disks in the minimum 2ⁿ−1 steps with step controls. Runs in your browser.

Free No signup Client-side Privacy friendly Updated

/

Pseudocode

Press Run to animate the algorithm.

How to use

  1. 1 Press Run to watch the recursive solution move every disk from peg A to peg C.
  2. 2 A bigger disk may never sit on a smaller one — watch the rule hold every move.
  3. 3 Use Shuffle for a different number of disks, or step through one move at a time.
  4. 4 The minimum number of moves for n disks is 2ⁿ − 1.

Why use this tool

  • See the classic recursion: move n−1 disks aside, move the biggest, then move them back.
  • Understand why the move count doubles with each extra disk (2ⁿ − 1).
  • A perfect first example of recursive problem decomposition.
  • Runs entirely in your browser. No signup, no uploads.

Frequently asked questions

What is the Tower of Hanoi?

A puzzle with three pegs and a stack of disks of decreasing size. The goal is to move the whole stack to another peg, moving one disk at a time and never placing a larger disk on a smaller one.

How many moves does it take?

The minimum is 2ⁿ − 1 moves for n disks — 7 for 3 disks, 31 for 5, and over a million for 20.

How does the recursive solution work?

To move n disks from A to C: recursively move n−1 disks from A to B, move the largest disk from A to C, then recursively move the n−1 disks from B to C.

Why is it a classic recursion example?

It reduces a problem of size n to two problems of size n−1 plus one move, which is the essence of recursive decomposition.

What is Tower of Hanoi Visualizer?

A Tower of Hanoi Visualizer animates the recursive solution to the classic three-peg puzzle: to move n disks it moves n−1 aside, moves the largest disk, then moves the n−1 back — never placing a larger disk on a smaller one, in 2ⁿ−1 moves.

Summary

Tower of Hanoi Visualizer is a free algorithm utility by Zerethon Tools. Animated recursive Tower of Hanoi solver — moves disks in the minimum 2ⁿ−1 steps with step controls. Runs in your browser. Runs entirely in the browser — no signup, no upload.

Category
Algorithm
Pricing
Free
Privacy
Browser-based
Signup
Not required

Privacy

Your data never leaves your browser unless explicitly stated. Tower of Hanoi Visualizer runs entirely client-side — no server upload, no logging, no tracking of your input.

New to this? Read the step-by-step explanation with Big-O analysis: Learn Dynamic Programming →

Related tools

Build, share, and grow on Zerethon Social

Free signup. Earn points, collect achievements, and connect with creators worldwide.

Try Zerethon free