Skip to main content

Java code visualizer

Visualize

See your code run, step by step

The fastest way to understand loops, recursion, lists and objects, and to find bugs.

  • The line that just ran and the line that runs next, highlighted in your code.
  • A plain-English note on every step: which variable changed, which function was called, what it returned.
  • The call stack as cards, so recursion is easy to follow: every call is numbered and shows its own variables.
  • Arrays as indexed boxes, ArrayLists and HashMaps as tables and objects with their fields, with arrows from each variable to what it points to.
  • When the code fails, the error explained in simple words, with a button to jump to the step where it happened.
  • Play, pause, go back and forward, or drag the slider. Works on phones too.
Just want to run code? Open the online Java compiler

What it supports

Java 21 in your browser

  • Java 21 with everything built in: lists, maps, strings, dates, streams and records.
  • Write one file with a main method; we compile and run it for you.
  • Type what your program reads in Input; what it prints appears in Output.
  • Runs stop after 5 seconds, so a loop that never ends cannot freeze anything.
  • Your code stays in your browser. Nothing is kept on our servers.

Input

How to read input in Java

Programs that read from the keyboard get their input from the Input box. Type one value per line, then press Run. The program reads the lines in order, just as it would from a keyboard.

Scanner sc = new Scanner(System.in);
int n = sc.nextInt();        // first value
String word = sc.next();     // next word
String line = sc.nextLine(); // rest of the line

Questions

Frequently asked questions

What is a Java code visualizer?
A tool that runs your Java program one line at a time and draws what happens: the line that ran, every variable, the call stack and the data your variables point to, with a short note on each step. It shows what a program does instead of only what it prints.
How do I visualize my own Java code?
Paste or type your program in the editor, add any input in the Input box, then press Visualize. Use play, the arrow buttons or the slider to move through the steps, forwards or backwards.
Is it free?
Yes, it is free. It works on laptops, tablets and phones. Create a free account to save your progress and practise with lessons and coding problems.
How is this different from the online compiler?
They share the same editor. The online Java compiler is for running programs and seeing their output; the visualizer opens with an example built to show the step-by-step view and explains each step. You can press Run or Visualize on either page.
Why does a long program stop being traced part-way?
Each trace records a limited number of steps so it stays fast. Programs with very long loops are cut off with a note; use smaller input to see the whole run.