๐ณRecursion Tree Visualizer
Pick a recursive function, choose an input, and step through the actual call tree as it builds.
Runs entirely in your browser. No data is sent to a server.
Free Recursion Tree Visualizer
Recursion is easy to write and hard to see โ our free recursion tree visualizer makes it visible. Pick a classic recursive function like factorial or Fibonacci, choose an input, and watch the actual call tree build itself, call by call, with each node showing its arguments, its recursion depth, and eventually its return value.
Step through the animation at your own pace to see exactly when each call is made and when it returns โ and for Fibonacci, watch how quickly the number of calls explodes as n grows, a vivid illustration of why naive recursive Fibonacci is so inefficient without memoization.
Built for computer science students learning recursion, call stacks, and algorithmic complexity for the first time. No sign-up, no downloads โ just an interactive way to finally see how recursion works. See the About page or the FAQ for more.
About the Recursion Tree Visualizer
Features
Preset functions
Factorial, Fibonacci, and binary search, each with a sensible input cap.
Step-through animation
Play, pause, or step call-by-call through the actual execution order.
Call-stack depth
Each node is labelled with its recursion depth.
Call-count comparison
For Fibonacci, the exponential call blow-up is contrasted with an iterative count.
Frequently Asked Questions
What functions can I visualize?
Factorial, naive Fibonacci, and a divide-and-conquer example like binary search's call splits.
Is it free?
Completely free, no sign-up or limits.
Can I step through the recursion call by call?
Yes, play/pause/step controls animate the tree building in actual call order.
Why is there a cap on the input value?
Recursion trees grow exponentially for some functions (like Fibonacci); the cap keeps the diagram readable and the browser responsive.
What does the tool show about call-stack depth?
Each node is labelled with its recursion depth, and the current depth is highlighted during the animation.
Why does Fibonacci's tree get so big so fast?
Naive recursive Fibonacci recomputes the same subproblems repeatedly, causing exponential call growth โ the tool visualizes and counts this.
Does it show return values?
Yes, once a call returns, its value is displayed on its node.
Is this useful for learning algorithm complexity?
Yes, seeing the actual call count helps build intuition for why some recursive approaches are inefficient.
Is my data stored?
No; everything runs in your browser.
Does it work on mobile?
Yes, the tree area scrolls horizontally on small screens.