Quick Start — From Zero to Running Code
Python 3 is pre-selected. You will see a code editor on the left, a toolbar at the top with Run and Debug buttons, and a terminal panel at the bottom right.
Replace the starter code or add below it. The editor shows line numbers, syntax coloring, and flags IndentationErrors with a red underline as you type. Python indentation is strict — use spaces consistently, not tabs.
OnlineGDB runs your code in the terminal panel at the bottom. Output appears instantly. Any error message includes the line number and a description — read it carefully before changing anything.
When your code calls input(), execution pauses silently — the terminal cursor will blink, waiting for you. Click inside the terminal panel, type your response, and press Enter. This is the most common source of confusion for first-time users: the program has not crashed; it is just waiting.
Click the Share link in the top toolbar. Copy the URL. It preserves your exact code for anyone who opens it.
Key Interface Areas
The main onlinegdb.com homepage defaults to C. The cheat sheet link goes directly to the Python 3 compiler. If you ever arrive at the wrong language, use this dropdown to switch before running.
Numbered lines, syntax coloring, and real-time indentation checking. OnlineGDB will underline indentation problems as you type — fix them before clicking Run.
Runs your program to completion. Output appears in the terminal panel. Use this for everyday “does it work?” runs.
Starts the program in debug mode. Execution pauses at the first breakpoint you have set. Use the step controls (Step Over, Step Into, Continue) to walk through your code one line at a time, watching variables change in the Variables panel on the right.
Shows program output and receives keyboard input. When input() is called, the cursor blinks here. Click inside and type your response. If you see the cursor blinking and nothing is happening, the program is waiting for you.
Visible only when the debugger is running. Shows every variable in scope and its current value — updated at each step. This is the panel that teaches you what your program is actually doing, as opposed to what you think it is doing.
Using the Debugger
The Debugger — Step-by-Step Execution
The debugger is what separates OnlineGDB from every other free online compiler. It lets you run your program one line at a time, pausing after each step so you can see exactly what each variable contains. You will not need this in week one — but you will reach for it the moment you have code that runs without errors yet produces the wrong answer.
Click the thin “+” gutter to the left of any line number in the editor. A red dot appears. The program will pause before executing that line.
The program runs until it hits your breakpoint, then pauses. The current line is highlighted in the editor. The Variables panel on the right shows all current values.
Step Over executes the current line and pauses at the next. Step Into steps inside a function call. Continue runs until the next breakpoint (or the end of the program).
After each step, the Variables panel updates. The moment a variable holds a value you did not expect — that is the line where the logic error lives. You found it without guessing.
- Bookmark the Python URL directly:
onlinegdb.com/online_python_compiler— the homepage defaults to C, which will confuse you at 11 p.m. - Use the debugger instead of adding print statements when you need to trace variable values. It is faster and cleaner for anything more than one or two variables.
- No account needed to run or share. Create an account only if you want to save projects permanently.
- OnlineGDB supports multiple files — click the “+” tab button to add a second Python file, useful when a program spans more than one module.
- The terminal accepts ANSI color codes in
print()output — handy if you want colored text in a Cross Training demo.
When input() is called, the program pauses silently. The terminal cursor blinks but shows no prompt. Click inside the terminal panel and type your value, then press Enter. This is the single most common beginner confusion with OnlineGDB.
The main onlinegdb.com homepage opens in C. If you see #include <stdio.h> in the editor, you are in C mode. Use the language dropdown at the top to switch to Python 3 before pasting your code.
Python requires consistent indentation — mixing tabs and spaces causes an IndentationError. If you pasted code from a word processor or a PDF, replace all indentation with spaces. Four spaces per level is the Python convention.
Perfect For … / Not the Right Tool When …
- Running a Cross Training Python snippet without starting VS Code
- Your program produces the wrong answer and you need to trace exactly why
- Learning how a loop or function executes step by step — the debugger is the best teacher for this
- Testing a snippet that uses
input()interactively - Sharing a runnable Python snippet with a classmate or teacher
- You need to run Java — use JDoodle for Java
- Building a full project with multiple files and external libraries (use VS Code + pip)
- Your program makes HTTP requests or opens network connections
- You need to read or write files on disk
- You are writing production code — this is a scratchpad, not a workspace