Python Visualizer
Run Python one line at a time and watch frames, objects and references change.
Frames
Objects
Keys: ← → step, Home End jump. Runs entirely in your browser on a built-in Python interpreter that covers the core language (functions, classes, lists, dicts, sets, exceptions, f-strings, math and seeded random). Runs stop after 1,000 steps.
What the Python visualizer shows
Each time you press Step, one line of your program runs. The code panel marks the line that runs next and the line that just ran. The Memory panel shows every variable in every function call, and the objects they point to, such as lists, dictionaries and class instances, with arrows for references.
It is most useful for ideas that are hard to picture in your head: recursion, two names pointing at the same list, closures, and objects that link to each other.
How to use it
- Pick an example, or press Edit code and paste your own program.
- If your program calls
input(), type one line per call in the Input lines box. - Press Visualize, then Step or the arrow keys to move through it. Drag the slider to jump.
- Watch the yellow outlines: they mark what changed in that step.
What it supports
The visualizer runs on a built-in interpreter written for teaching. It covers the core language: functions, classes and inheritance, lists, tuples, dictionaries and sets, comprehensions, exceptions, f-strings, and the math and random modules. Random numbers are seeded, so every run gives the same results.
It does not support decorators, with, generators with yield, async code or other imports, and a run stops after 1,000 steps. To run any Python program, including packages, use the Python playground. New to Python? Start with the free Python course.
Frequently asked questions
Is this like Python Tutor?
It works in a similar way: you step through your code and see variables, function calls and objects drawn as a diagram. It runs entirely in your browser, with no sign-up.
Does my code leave my device?
No. The visualizer runs in your browser, and your code is not sent anywhere.
Why does my program stop with a message the playground doesn't show?
The visualizer uses its own interpreter that covers a teaching subset of Python. When it meets something it does not support, it says so. Run the full program in the Python playground instead.