How to Run Python Notebooks in the Browser with Pyodide
Run Jupyter-style Python notebooks in a browser tab with Pyodide: pandas, matplotlib, packages, .ipynb files, and when a local install is still better.

How to Run Python Notebooks in the Browser with Pyodide
Notebooks mix code, results and explanation in one document, which is why they became the standard way to explore data and teach programming. The usual setup still requires installing Python, a package manager and Jupyter, which is a barrier on school laptops, locked-down work machines and tablets. Pyodide removes it by compiling the real CPython interpreter to WebAssembly. This guide explains how browser notebooks work, what they are good at and where they stop, using the Python Notebook in the Browser.
What Pyodide is
Pyodide is a port of CPython to WebAssembly, maintained as an open-source project. It includes the standard library and a large set of scientific packages compiled for the browser: NumPy, pandas, SciPy, matplotlib, scikit-learn and many more. Your code runs on your own device, inside the page, with no server executing it. The trade-off is a first download of about ten megabytes for Python, plus more when you import big packages, which the browser then caches.
Cells and state
A notebook is a list of cells. Code cells run Python and keep their variables for later cells; Markdown cells hold headings, notes and explanations. The value of the last expression in a cell is displayed automatically, so ending a cell with df shows a table. The execution counter next to each cell tells you the order things ran in, which matters: running cells out of order is the most common source of notebook confusion. When in doubt, restart and run all.
Data analysis with pandas
pandas turns tabular data into DataFrames you can filter, group and summarise. A typical flow is to load data, inspect it with head() and describe(), clean columns, add calculated columns and group by a category. In a browser you can build DataFrames from code or from text you paste, and read files through standard Python I/O on data loaded into memory. Keep datasets moderate in size: a few hundred thousand rows are fine, many millions are better handled on a local machine.
Charts with matplotlib
Plots appear under the cell as images. Create a figure, draw bars or lines, set titles and labels, and the notebook captures the figure after the cell runs. Saved notebooks keep plots as PNG, so a colleague can see them without running anything.
Installing packages
Packages that Pyodide has already built load automatically from your imports. For other pure-Python packages on PyPI, micropip can install wheels at runtime. Packages that contain C or Rust extensions only work if Pyodide has a build for them; if not, the install fails with a clear message. Checking the Pyodide package list before you plan a project saves frustration.
The .ipynb format
Jupyter notebooks are JSON files following the nbformat specification. Each cell stores its type, source, outputs and execution count, and version 4.5 adds a stable id per cell. Because the format is standard, a notebook saved in the browser opens in JupyterLab, VS Code or Google Colab, and the reverse also works. That makes browser notebooks a good companion rather than a replacement: draft anywhere, continue on a full setup when needed.
Good notebook habits
- Put a short Markdown cell at the top saying what the notebook does and where the data comes from.
- Keep cells small and focused; one idea per cell.
- Restart and run all before sharing, so the outputs match the code.
- Move reusable code into functions, and eventually into a module.
- Do not store passwords or API keys in notebook cells you plan to share.
When to use a local install instead
Browser notebooks shine for teaching, quick calculations, demonstrations and sharing reproducible snippets. A local or server Jupyter is still better for long computations, big datasets, GPU work, database connections and packages with native extensions that are not available for Pyodide. Choosing the right tool for the size of the job keeps both experiences smooth.
Limits
Code runs on the page's main thread, so a long loop freezes the tab until it finishes and can only be stopped by reloading. There is no persistent file system, no raw network sockets, and web requests are subject to the browser's CORS rules. Results depend on your device's memory and speed, and very large workloads are not practical in a browser.



