Paste it, run it, step through it

Python code visualizer

Paste a Python function and its arguments, or a short script. It runs in your browser, each line it runs is a step, and the stage shows what that line read, what it changed and which way it went.
or Ctrl+Enter
StopYour code

Press Run to trace the code.

How it works

Real Python, in your browser
Your code runs on Pyodide, Python 3.13 built for WebAssembly. The standard library is there, heapq and collections included. Packages like numpy aren't.
Every line is a step
Each line of your functions that runs is a step you can play, scrub or link to. A run stops at 100,000 lines or 2 seconds, so a loop that never ends can't hang the page.
Every value by its shape
A list of dicts is a table, a dict of numbers is a ledger, a list of lists is a grid, an object is a card. Each step marks what its line read and changed, works out its test (`2 < 1` is False) and says which way the run went.
The view comes from the run
Rules read what your variables do. Two names indexing a list are pointers, a list pushed and popped is a stack, heapq is a heap, a table filled from its own cells is DP. Those runs get the pattern's own stage too.
Change one thing
Every number and value in your code is a control. Change one, the code runs again, and the stage says what came out differently.
Links keep your code private
A link holds the code after its #, which your browser never sends, so it stays out of server logs. Code from a link runs in a sandbox with no access to your account or this page.