b2KIT

Python Playground (WASM)

Run Python code directly in the browser via Pyodide WebAssembly with standard library support.

Tested tool guide Tested browser tools Checked August 16, 2026

What Python Playground (WASM) does, with a checked example

This playground runs real CPython inside your browser tab. The interpreter is compiled to WebAssembly by Pyodide, so scripts execute locally with the full standard library and no server involvement: the code you type never leaves your machine. The most common surprise is startup - the first run downloads a multi-megabyte WASM runtime, so output can lag several seconds behind your click. It is a full interpreter, not a calculator: define functions, import modules, and run multi-line programs, and the page keeps one interpreter session alive, so names from an earlier run can affect the next.

Worked example

A concrete input and expected output from the current implementation.

Input

def fib(n):
    a, b = 0, 1
    for _ in range(n):
        a, b = b, a + b
    return a

print([fib(i) for i in range(10)])

Expected output

[0, 1, 1, 2, 3, 5, 8, 13, 21, 34]

The playground executes this as a complete program: fib is defined, the comprehension calls it for 0 through 9, and print writes the resulting list. The values follow the Fibonacci recurrence, so fib(0)=0, fib(1)=1, and each later term is the sum of the two before it.

How the result is produced

1

How the interpreter runs

The page loads Pyodide, a build of CPython compiled to WebAssembly, into your tab. When you press Run, the interpreter executes your code and print() output is captured into the results pane. Imports resolve against the standard library bundled with the WASM build, and Pyodide-built packages such as numpy, pandas, and matplotlib are usable without installing anything.

2

Session and startup behavior

The interpreter instance stays alive for the life of the page, so a later run typically sees variables and functions defined by an earlier run; reloading the page wipes everything and starts fresh. The first run is the slow one, because the several-megabyte WASM runtime must download and instantiate before any output can appear. Subsequent runs start in a fraction of that time.

Good uses

  • Checking an algorithm or snippet before adding it to a real project, with zero setup: paste the function, run it, verify the numbers.
  • Quick standard-library answers: formatting a date with datetime, testing a regex against sample strings with re, or reshaping JSON with json, all in one script with immediate output.
  • A one-off computation on a machine where Python is not installed or package installation is blocked, leaning on the numpy and pandas builds that ship with Pyodide.

Limits and checks

  • State persists between runs in the same tab: a run can fail or behave differently because an earlier run redefined a name. Reload the page whenever you want a guaranteed clean interpreter.
  • An empty output pane before the first run does not mean your code produced nothing - the WASM runtime is still downloading. On slow connections this can take many seconds; if output never appears, check the browser console for a failed download.
  • The bundled Python and package versions may be older than your local install, so a feature that works in your Python 3.13 may not exist here. File operations also target an in-memory virtual filesystem: you cannot read local files, and files you write vanish on reload.

Common questions

Does running code here send my code anywhere?

No. Pyodide executes the code inside your browser tab; there is no server-side interpreter and nothing you type or run is uploaded. The only network traffic is the download of the WASM runtime and any package wheels when they are first needed, which you can verify in the browser's network panel.

Can I install packages with pip?

Only in a limited sense. Pyodide ships a curated set of packages compiled for WebAssembly, including numpy, pandas, and matplotlib. A package with C extensions works here only if a WASM build exists for it; many packages you could pip install locally will fail, so check the bundled package list before relying on one.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools