Browser Python
import matplotlib.pyplot as plt
import numpy as np

x = np.linspace(0, 10, 200)

fig, ax = plt.subplots(figsize=(8, 5))
ax.plot(x, np.sin(x) * np.exp(-0.1 * x), label="Fading sine")
ax.plot(x, np.cos(x) * np.exp(-0.1 * x), label="Fading cosine")
ax.set_title("Two fading waves")
ax.set_xlabel("Time (s)")
ax.legend()
ax.grid(True, alpha=0.3)

plt.show()

Press Run or Ctrl ↵ to execute main.py.
Type program input here while it runs.

Browser Python

Python in the Browser

Browser Python runs CPython compiled to WebAssembly (Pyodide 0.27) inside this tab. Nothing is sent to a server to run, so your program and its output stay on your device, and it keeps working on a slow or patchy connection once Python has loaded.

The editor above opens with a Matplotlib chart. Press Run: the first run takes a few seconds while Python downloads, and later runs start straight away because your browser keeps it.

Try it above

Packages load when you import them

There is no pip step. When your code imports a package, it is fetched first: from Pyodide’s own collection (NumPy, pandas, SciPy, Matplotlib, scikit-learn and many more) or, for pure Python packages, from PyPI. Run settings also has an Install packages box for anything you want ready before the run.

Browser Python
import pandas as pd

sales = pd.DataFrame({
    "month": ["Jan", "Feb", "Mar", "Apr"],
    "units": [120, 135, 98, 160],
})
sales["change"] = sales["units"].diff()
print(sales.to_string(index=False))
print("Best month:", sales.loc[sales["units"].idxmax(), "month"])
Output
month  units  change
  Jan    120     NaN
  Feb    135    15.0
  Mar     98   -37.0
  Apr    160    62.0
Best month: Apr

Charts, input() and the debugger

  • plt.show() in Matplotlib and fig.show() in Plotly open the chart in the Plots tab next to the console.
  • input() waits in the console. Type the answer and press Enter, however long you take.
  • Click left of a line number to set a breakpoint, then press Debug to step through the program and read its variables.
  • Ruff checks the code as you type and lists what it finds under Problems.

Browser Python or Python on Code Runner?

The Python language runs on our Code Runner servers with CPython 3.11 to 3.15, which suits programs that need the newest Python, long runs or exact judge behaviour. Browser Python suits data work and charts, teaching on locked-down machines, and code you would rather not send anywhere. A program that reads files from the network or starts other programs will not work in the browser.

Questions

Does my code leave my computer?

No. Python runs inside your browser tab, so your program and its output stay on your device. Only a share link or a saved project stores a copy of your code with us.

Which packages can I import?

The standard library, the packages Pyodide ships such as NumPy, pandas, SciPy and Matplotlib, and pure Python packages from PyPI. Each one is fetched the first time your code imports it.

Why is the first run slow?

Python itself downloads to your browser on the first run, which takes a few seconds. Your browser keeps it, so later runs start quickly.

Can a program ask for input?

Yes. When it calls input(), the question appears in the console. Type your answer and press Enter.