Home / Calculators / Factorial Recursion Visualizer
Free online tool

Factorial Recursion Visualizer

Trace factorial calls for one integer from 0 to 200 and copy the exact BigInt result. See base cases, nested indentation and the final factorial value.

Start using

Recursion Visualizer

Enter one integer n from 0 through 200. The page displays the nested call sequence for factorial(n), with two additional leading spaces at each recursive depth.

The base case is n less than or equal to 1. Results use BigInt multiplication, so factorial values through 200 are printed as exact integers instead of becoming floating-point Infinity after 170.

For n=3 the trace contains factorial(3), factorial(2) and factorial(1), followed by exact result 6. Inputs outside the range or non-integers are rejected.

This visualizes one direct recursive factorial call chain only. It does not execute user code, animate a call stack, show returns on separate steps or visualize Fibonacci.

The calculation is educational and runs in the browser. The call count is max(1,n); the accumulated indentation is n(n−1) spaces, so total trace text grows quadratically, and the fixed 200 limit prevents excessive recursion or output.

Processing takes place locally in your browser.