Online Python Compiler

Write and run Python 3.12 online with no installation. Standard library, input(), and packages like NumPy and pandas load automatically. Code runs in your browser.

Python 3.12 (Pyodide 0.26) · Runs in your browser, so your code never reaches our servers.
main.pyPython
Output

            
Input (stdin), one line per input() call
Ctrl/⌘ + Enter to run

How to use the online Python compiler

  1. Write or paste your code into the editor. The page starts with a short example; Reset example brings it back at any time.
  2. If your program calls input(), type the answers into the Input (stdin) box below the output, one line per input() call.
  3. Press Run or use Ctrl + Enter (⌘ + Enter on a Mac).
  4. Read the result in the Output panel. Anything printed to stderr, including tracebacks, is highlighted as an error.
  5. Choose a time limit of 5, 15 or 60 seconds. If a script runs longer (an accidental while True:, for example), it is stopped automatically. You can also press Stop at any moment.

The first run downloads the Python runtime, about 10 MB. Your browser caches it, so later runs start much faster. Use Copy or main.py to save your script.

Your code never leaves your device. Python runs inside your browser in a Web Worker, so nothing is uploaded to or stored on our servers. The editor remembers your last code in your browser's local storage, and in no other place.

What's supported

The compiler uses Python 3.12 through Pyodide 0.26, the CPython interpreter compiled to WebAssembly. It is real CPython, not a Python-like imitation, so the language behaves exactly as it does on your computer.

  • The standard library: math, collections, itertools, datetime, json, re, dataclasses, statistics and more.
  • Automatic package loading: when your code imports a package that Pyodide provides, such as NumPy or pandas, it is downloaded on the fly. Many pure-Python and scientific packages are available.
  • Standard input through input() and sys.stdin, fed from the stdin box.
  • async/await: code runs with runPythonAsync, so a top-level await works.

Limitations to keep in mind:

  • No network sockets. Modules such as socket, urllib.request and requests cannot open connections from here.
  • No persistent files. You can create and read files with open(), but they live in memory and are lost when you reload the page or press Stop.
  • Plots are not displayed. matplotlib can be imported, but no figure is shown, so print numbers or tables instead.
  • Packages with native code that Pyodide does not ship cannot be installed.

Python quick reference

from dataclasses import dataclass

@dataclass
class Item:
    name: str
    price: float

cart = [Item("pen", 1.5), Item("book", 12.0)]
total = sum(i.price for i in cart)
print(f"{len(cart)} items, total {total:.2f}")

if total > 10 and cart:
    print("Free shipping!")
TaskSyntax
Print formatted textprint(f"{x:.2f}")
Read a line of inputname = input("Name? ")
Convert input to a numbern = int(input())
List comprehension[x * 2 for x in data if x > 0]
Dictionary loopfor k, v in d.items():
Handle an errortry: ... except ValueError as e: ...

Tips

  • If your program asks for input more often than the stdin box has lines, Python raises EOFError. Add a line for every input() call.
  • Large imports like pandas take a few seconds the first time. The download counts toward the time limit, so pick 60 s for heavy scripts.
  • Each run starts with fresh variables, but modules you have already imported stay loaded, so repeat runs are quick.
  • Working with JSON output? Paste it into the JSON formatter to pretty-print and validate it.
Tip: Pressing Stop shuts down the Python runtime. The next run starts it again from your browser cache, which takes a moment.

Frequently asked questions

Is this a real Python interpreter?

Yes. Pyodide is CPython 3.12 compiled to WebAssembly. The syntax, built-in functions and standard library match desktop Python. The main differences come from running in a browser: there is no network access and no permanent file system.

Can I use NumPy and pandas?

Yes. Import them as usual and they are downloaded the first time you run the code. Many other scientific and pure-Python packages that Pyodide provides load in the same way.

How do I give my program input?

Type the values into the stdin box, one line for each input() call, in the order your program asks for them. Then press Run.

Why does my script stop after 15 seconds?

The default time limit protects you from infinite loops that would freeze the tab. Choose 60 s from the time limit menu for longer computations.

Can I run other languages too?

Yes. Try the online JavaScript compiler or browse all the free developer tools.

Copied to clipboard