Java visualizer
Paste Java and step through it line by line. Free, no account needed. Sign in to save and share links.
Call stack
How to use the Java visualizer
- 1
Paste a program
Write or paste Java with a main method, or just a few statements. Up to 120 lines.
- 2
Press Visualize
Your code runs on a real Java compiler, and every step is recorded.
- 3
Step through it
Use Next and Back, press Play, or drag the slider to any step.
- 4
Share it
Sign in to save the program and get a link anyone can open, no account needed.
What the visualizer shows
The call stack
Every method call gets its own frame with its own local variables, so recursion and helper methods are easy to follow.
Objects and arrays
Objects, arrays and lists are drawn separately, with arrows from each variable that refers to them.
The current line
The line that just ran and the line that runs next are both marked, so you always know where you are.
Program output
Everything printed with System.out appears as it happens, step by step.
Java examples to step through
Each one opens in the visualizer with notes on what to watch.
- Java recursion visualizer Step through a recursive Java method and watch each call land on the call stack, hit the base case, and return its value back up.
- Bubble sort in Java, step by step Watch bubble sort run in Java one comparison at a time. See each swap happen in the array and the largest values settle at the end.
- Binary search in Java, step by step Step through binary search in Java and watch low, middle and high close in on the target in a sorted array.
- Java ArrayList visualizer See a Java ArrayList change as you add, insert and remove items. Watch indexes shift and the list grow and shrink step by step.
- Java linked list visualizer Build a linked list in Java and watch each node point to the next. Step through a traversal as current follows the references.
- Java objects and references, visualized See why two Java variables can point to the same object. Step through aliasing, == versus equal values, and objects passed to methods.
- Java 2D array visualizer Fill a Java 2D array with nested loops and watch each row and column change. See how an array of arrays is laid out in memory.
Common questions
Is the Java visualizer free?
Yes. It is free to use, with no ads and no paid tier. You do not need an account to visualize code.
What Java does it support?
Programs with a main method, or a few plain statements, up to 120 lines. Classes, objects, arrays, strings, loops, recursion and nested classes all work. You can import ArrayList, Arrays, List, Collections, Random and Scanner.
Can I share a visualization with my students?
Yes. Sign in, press Share, and you get a link that opens the same program at the same step. Students can open it without an account and edit their own copy.
Is my code saved?
Only when you sign in and press Share. Visualizing code without an account does not save it.
Does it work on Chromebooks and phones?
Yes. It runs in the browser, so there is nothing to install.