Skip to content

Python Playground

Run Python in your browser with standard input, output and a stop button.

Python code

Processed in your browser.

Tab inserts four spaces. Shift + Tab leaves the editor. Ctrl/⌘ + Enter runs the code.

UTF-8 .py files · up to 40,000 characters · read locally

Enter one response per line for input(). End of the supplied lines raises EOFError.

40,000 code characters · 10,000 input characters · 15 seconds per run · 65,536 output characters

First run downloads the pinned Pyodide 0.28.3 engine from jsDelivr. Your code and input are not sent with that download.

Output

Run your code to see its output.

Each run starts fresh. Network requests, parent-page access and persistent browser storage are restricted. No pip installs, interactive graphics, sockets or desktop processes.

Run a small Python program

Write Python in main.py and select Run Python. The muted example prints a greeting and the squares of the numbers 0 through 4. The first run needs an internet connection to download the versioned Python engine; later runs on this page reuse the downloaded bytes. When the code field is empty, Run Python runs this example and Save .py saves it. Clear resets your code, input and output.

For a quick second example, run import statistics followed by print(statistics.mean([3, 6, 9])). The output is 6. Python expressions on the final line are also displayed when they return a value. Ordinary print output and error output remain separate, and a traceback shows the location of a Python error.

Supply input before you run

For a program containing name = input('Name: '), enter a name on the first line of Standard input before running. Follow it with print('Hello,', name). Each input() consumes one supplied line; exhausting them raises EOFError rather than opening a browser prompt.

Use Tab in the editor to insert four spaces. Ctrl or Command plus Enter runs the current program. Save .py downloads the current code as a source file for a local Python editor. Copy output copies the captured console text, including any error text.

Basic colors distinguish keywords, strings, numbers and comments. Enter keeps the current indentation and adds four spaces after a block such as for or if ending in a colon. Shift + Enter inserts a plain newline. Open .py reads a UTF-8 file locally; it asks before replacing code you have typed. Invalid or oversized files leave your code intact.

Stop and start again

Stop ends the current worker, including a busy while True loop, and the next run starts a fresh Python session. A 15-second execution limit begins after engine startup, and a 65,536-character limit bounds captured output. Editing code or input cancels an active run and clears the older result.

Variables, imports and files do not carry into another run. Put everything needed by your program in the editor. Browser memory remains finite, so large allocations can still exhaust the device before a timed stop; keep examples small, particularly on phones. A fresh session is not a full desktop development environment.

Supported Python and privacy

This tool uses the standard-library subset bundled with Pyodide 0.28.3. Common modules such as math, random, statistics and json work here; separately packaged modules such as NumPy and arbitrary pip installs are not loaded. Desktop windows, operating-system processes, TCP sockets and interactive plotting are outside this tool’s scope.

Code executes in a worker inside an opaque-origin sandbox with a restrictive content policy. The worker keeps long computations off the page’s main thread; the separate origin and policy provide the access restrictions. External code requests are blocked. The parent page downloads engine files from jsDelivr without attaching your source or input, and no account or code-execution API is used.

Pyodide 0.28.3 · GitHub · MPL-2.0

Frequently asked questions

Why does the first run take longer?

The browser downloads and initializes Python and WebAssembly. A failed download can be retried with Run Python.

Can I install packages?

No. This version supports the bundled standard library only, not pip or an external package download service.

Why did my variable disappear?

Every run creates a fresh session. Include the variable assignment in the code you run.

Does it work offline or on a phone?

A first engine download needs internet. The layout adapts to small screens, but memory and WebAssembly support depend on your browser and device.