What Is IDLE in Python? (Shell, Editor and Tips)

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?

SystemHow to open IDLE
WindowsStart menu, search IDLE, or run py -m idlelib
macOSApplications > Python 3.x > IDLE, or idle3 in Terminal
Linux (Ubuntu)sudo apt install idle3, then run idle3
Any systempython -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].
Command Prompt output of python -m idlelib -h listing IDLE's command-line options
IDLE’s own help text: -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:

IDLE Shell window in Python 3.12 showing arithmetic, a variable, an f-string, a NameError in red and a for loop
A real session: a calculation, a formatted price, a typo that raised NameError, and a two-line loop.

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:

IDLE editor window showing a Python sales tax script with syntax highlighting
A small sales tax script in IDLE’s editor. Comments are red, strings green, built-ins purple.

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

IDLE shell after Run Module showing the RESTART line and the sales tax script output
The RESTART line names the file, then the script’s output appears: a $137.74 total.

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

  1. In the shell, choose Debug > Debugger to open the Debug Control window.
  2. In the editor, right-click a line and choose Set Breakpoint.
  3. Press F5. The program stops at the breakpoint.
  4. 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

ActionHow
Run the current fileF5
Show completionsTab (or Ctrl+Space)
Recall the previous commandAlt+P (Alt+N for next)
Indent / dedent a blockCtrl+] / Ctrl+[
Comment out linesAlt+3 (Alt+4 to uncomment)
Bigger font, dark themeOptions > Configure IDLE

IDLE vs VS Code and PyCharm

IDLEVS Code / PyCharm
SetupComes with PythonSeparate install and extensions
Best forLearning, quick testsReal projects
Virtual environmentsUse the venv’s Python to launch itBuilt-in interpreter selection
Git, linting, testingNoYes

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.