โ† Back to all tools

๐Ÿ”„ Recursion Visualiser

Watch recursive functions call themselves, build up a call stack, and unwind with results. Step through each call.

Designed with the WJEC specification in mind
CS A-Level Unit 3
โš™๏ธ

Choose a recursive function

Call Stack

Step-by-step

Select a function and click Visualise or Step.
๐Ÿ“–

Key Concepts

Recursion = a function that calls itself. Every recursive function needs:

1. Base case โ€” when to STOP (prevents infinite recursion)

2. Recursive case โ€” calling itself with a SIMPLER problem

Call stack: Each call creates a new "frame" on the stack. When the base case is reached, frames unwind from top to bottom, each returning its result to the caller.

Warning: Too many recursive calls โ†’ Stack Overflow! Python has a default limit of ~1000 recursive calls.