What is IDLE in Python? It’s the Integrated Development and Learning Environment, the simple editor and interactive shell that ships with Python itself. It’s written in Python with tkinter, so it runs the same on Windows, macOS and Linux:
python -m idlelib # open IDLE from any terminal
py -m idlelib # Windows launcher version
All the screenshots here are from the real IDLE that came with Python 3.12.5 on Windows 11; I typed every command into it myself.
We’ll cover what IDLE includes, how to open it, the shell and editor windows, running a file with F5, the debugger, and how it compares with VS Code and PyCharm.
What does IDLE include?
- Shell window: an interactive Python prompt with colored output and error messages.
- Editor windows: syntax highlighting, smart indentation, call tips and auto-completion.
- Run Module (F5): runs the file in the shell with a fresh session.
- Debugger: breakpoints, stepping and a view of local and global variables.
- Search and browsers: find and replace, search in files, a module browser and a path browser.
You don’t install it separately on Windows or macOS; the python.org installer includes it. Need Python first? See installing Python on Mac or on Ubuntu.
How do you open IDLE?
| System | How to open IDLE |
|---|---|
| Windows | Start menu, search IDLE, or run py -m idlelib |
| macOS | Applications > Python 3.x > IDLE, or idle3 in Terminal |
| Linux (Ubuntu) | sudo apt install idle3, then run idle3 |
| Any system | python -m idlelib with the Python you want to use |
The command-line version takes options too, such as opening a file directly or setting a window title:
python -m idlelib -h
Output:
USAGE: idle [-deins] [-t title] [file]*
idle [-dns] [-t title] (-c cmd | -r file) [arg]*
idle [-dns] [-t title] - [arg]*
-h print this help message and exit
-n run IDLE without a subprocess (DEPRECATED,
see Help/IDLE Help for details)
The following options will override the IDLE 'settings' configuration:
-e open an edit window
-i open a shell window
The following options imply -i and will open a shell:
-c cmd run the command in a shell, or
-r file run script from file
-d enable the debugger
-s run $IDLESTARTUP or $PYTHONSTARTUP before anything else
-t title set title of shell window
A default edit window will be bypassed when -c, -r, or - are used.
[arg]* are passed to the command (-c) or script (-r) in sys.argv[1:].
Examples:
idle
Open an edit window or shell depending on IDLE's configuration.
idle foo.py foobar.py
Edit the files, also open a shell if configured to start with shell.
idle -est "Baz" foo.py
Run $IDLESTARTUP or $PYTHONSTARTUP, edit foo.py, and open a shell
window with the title "Baz".
idle -c "import sys; print(sys.argv)" "foo"
Open a shell window and run the command, passing "-c" in sys.argv[0]
and "foo" in sys.argv[1].
idle -d -s -r foo.py "Hello World"
Open a shell window, run a startup script, enable the debugger, and
run foo.py, passing "foo.py" in sys.argv[0] and "Hello World" in
sys.argv[1].
echo "import sys; print(sys.argv)" | idle - "foobar"
Open a shell window, run the script piped in, passing '' in sys.argv[0]
and "foobar" in sys.argv[1].

-e opens an editor, -r file runs a script, -d starts the debugger.Opening IDLE with python -m idlelib is handy when you have several Python versions, because IDLE uses whichever Python launched it.
The IDLE shell window
IDLE opens on the shell by default. Type a line, press Enter, and you’ll see the result straight away. Errors show in red with a traceback, so typos are easy to spot:

For a multi-line block like a loop, IDLE indents the next line for you, and a blank line runs it. It works like the Python interpreter in a terminal, just with colors and menus.
Writing and running a file in IDLE
For anything longer than a few lines, use File > New File. This opens an editor window with syntax colors, where you can save your work as a .py file:

Press F5 (or Run > Run Module) to save and run it. IDLE restarts the shell so leftover variables can’t affect the result:

After it runs, the script’s variables stay in the shell, so you can type subtotal and inspect them. That’s one of my favorite IDLE habits for learning. See how to run a Python script for terminal options.
Using the IDLE debugger
- In the shell, choose Debug > Debugger to open the Debug Control window.
- In the editor, right-click a line and choose Set Breakpoint.
- Press F5. The program stops at the breakpoint.
- Use Step, Over and Go, and tick Locals to watch variables change.
It’s basic compared with VS Code’s debugger, but it’s enough to see how a loop works line by line. For printed error details, see printing a stack trace.
Handy IDLE shortcuts and settings
| Action | How |
|---|---|
| Run the current file | F5 |
| Show completions | Tab (or Ctrl+Space) |
| Recall the previous command | Alt+P (Alt+N for next) |
| Indent / dedent a block | Ctrl+] / Ctrl+[ |
| Comment out lines | Alt+3 (Alt+4 to uncomment) |
| Bigger font, dark theme | Options > Configure IDLE |
IDLE vs VS Code and PyCharm
| IDLE | VS Code / PyCharm | |
|---|---|---|
| Setup | Comes with Python | Separate install and extensions |
| Best for | Learning, quick tests | Real projects |
| Virtual environments | Use the venv’s Python to launch it | Built-in interpreter selection |
| Git, linting, testing | No | Yes |
I recommend IDLE for your first weeks with Python, then a full editor once projects grow. See Python extension for VS Code when you’re ready to switch.
If you’re new to Python, these guides come next:
Frequently asked questions
What is IDLE in Python?
IDLE is Python’s Integrated Development and Learning Environment: a simple editor and interactive shell that ships with Python.
Is IDLE installed with Python?
Yes, with the python.org installers for Windows and macOS. On Ubuntu, install it with sudo apt install idle3.
How do I run a program in IDLE?
Open or create a file in the editor and press F5, or choose Run > Run Module.
Is IDLE good for beginners?
Yes. It needs no setup and shows results and errors clearly. Move to VS Code or PyCharm for larger projects.
Why does IDLE say RESTART when I run a file?
IDLE restarts the shell before each run so old variables can’t change the result.
Where is IDLE documented?
See IDLE in the Python docs.

Bijay Kumar is a 13-time Microsoft MVP with more than 18 years in software development, and the founder of Python Guides and TSinfo Technologies. He started out building .NET and SharePoint solutions at HP, TCS and KPIT before moving into Python, machine learning and AI, and he also builds web apps with TypeScript and React. He writes the tutorials here himself, and every example is run before publishing so you see the real output. More about Bijay · Microsoft MVP profile · LinkedIn