Code cells, unchanged
Every code cell is copied byte-for-byte: imports, functions, indentation and trailing comments. The script runs the same code the notebook ran.
IPYNB to PY
Drop in an .ipynb file and download a clean .py script: code cells stay exactly as they are, markdown becomes comments around # %% cell markers, and nothing is uploaded anywhere.
Converted in your browser — the notebook is never uploaded. You can also drop it anywhere on this page.
That file could not be opened
notebook.ipynb
Script preview (first 200 lines)
The script is assembled in this tab from the notebook you chose. Nothing is uploaded, and the download is yours alone — the same file every time for the same notebook.
Converti questo notebook in PDF0 bytes uploaded
Parsing and script assembly happen on your device.
100% of the code kept
Code cells are emitted unchanged — indentation and all.
# %% cell markers
The percent format VS Code and Jupytext read back.
6 notebook sources
Jupyter, JupyterLab, Colab, VS Code, Kaggle, Deepnote.
What the script keeps
The converter reads the notebook format, not a screenshot of it, so the output is a real Python file you can run, lint, review and commit.
Every code cell is copied byte-for-byte: imports, functions, indentation and trailing comments. The script runs the same code the notebook ran.
Markdown cells become # comment lines, so headings, lists and links stay readable in the script without breaking Python syntax.
Cells are separated with the same percent-format markers nbconvert and Jupytext write, so VS Code can turn the script back into a notebook.
The script follows the notebook top to bottom, so the execution order you tuned in Jupyter is the order the file runs in.
A plain-text .py file diffs, reviews and runs in a terminal or a pipeline — places where an .ipynb file is at best awkward.
Plot and table outputs are rendered results, not source. They are dropped so the script is clean code you can re-run to regenerate them.
Compatibility
Notebooks from Jupyter Notebook, JupyterLab, Google Colab, Kaggle, Deepnote and VS Code all convert, including the older nbformat 3 files.
Notebook formats
Cell types
Where the script goes
Known limits
How it works
Drop in an .ipynb file and download a clean .py script: code cells stay exactly as they are, markdown becomes comments around # %% cell markers, and nothing is uploaded anywhere.
Drop the notebook in
Choose an .ipynb file or drag it onto the page; it is parsed on your device and the script is assembled immediately.
Check the script
Code cells appear unchanged with # %% borders; markdown cells are visible as comments, so nothing from the notebook is lost.
Download the .py file
Save notebook.py alongside your project: run it, commit it, review it in a pull request, or hand it to someone without Jupyter.
Six ways to turn a notebook into a Python script, from the browser converter above to the tooling built into Jupyter, VS Code and PyCharm — pick the one that fits where you already are.
The command-line standard: jupyter nbconvert --to script notebook.ipynb writes notebook.py in the percent format. It ships with Jupyter, needs no extra install and works in a CI pipeline — the route to choose when you already live in the terminal.
Jupytext converts notebooks to .py and keeps the two files in sync, so a script and its notebook can be edited at the same time. Run jupytext --to py:percent notebook.ipynb once, add it to your Jupyter config, and every save writes both files.
With the notebook open in VS Code, the Jupyter extension's export command offers Python Script — the same percent format this page produces. Convenient when the notebook is already open; no use when it is still a Colab or Kaggle download.
PyCharm Professional converts an open .ipynb with right-click → Save As → Python file, or Export → Python File. Any edition can also drop the file into this page and skip the IDE entirely.
Classic Jupyter Notebook has File → Download as → Python (.py); JupyterLab exposes the same conversion through File → Save and Export Notebook As. If your version hides the entry, nbconvert in a terminal is the same job.
In a hurry? Use the converter at the top.
The browser converter above reads the same notebooks as every route on this page and produces the same percent-format script — with nothing installed and nothing uploaded.
FAQ
Short answers about converting a Jupyter notebook to a Python script — what happens to markdown, how nbconvert differs from this page, and whether the output runs as-is.
Use the converter at the top of this page: choose or drop in your .ipynb file, and the browser turns it into a Python script with # %% cell markers — code cells unchanged, markdown as comments. Then download the .py file. No upload, no install and no terminal involved.
Run jupyter nbconvert --to script notebook.ipynb. nbconvert ships with Jupyter, so it needs no extra install, and it writes a notebook.py in the percent format next to your notebook. This page produces the same layout in the browser instead, without opening a terminal.
A .py file can only contain Python, so markdown cells become # comment lines between the cell markers. Headings, lists and notes survive as readable comments; only rendered images and LaTeX have no script form and are left out.
Yes — the code cells are copied unchanged in notebook order, so if the notebook ran top to bottom, the script does too. Two caveats: outputs are not carried over (re-run the script to regenerate them), and Jupyter magics like %matplotlib inline or shell lines like !pip install are not valid Python, so comment those out before running.
Both produce the same style of script, and nbconvert is the right tool inside a pipeline you already have. This converter runs in the browser instead: nothing is installed, nothing is uploaded, and it works on machines without Jupyter — for example when you received a notebook and only need the code.
Three common reasons: running the code somewhere without a kernel — a scheduler, a CI job, a server; reviewing changes as a plain-text git diff, which no notebook rendering gives you; and importing functions into another project. An .ipynb file stores outputs and metadata; a .py file is just code your tools already understand.
VS Code can export a notebook open in the editor: use the Jupyter extension's export command and choose Python Script, which writes the percent format. If the notebook is only a file (Colab, Kaggle, a download), drop it into this page instead — the script is the same either way.
In Colab use File → Download → .ipynb to save the notebook locally, then convert that file here. Colab has no direct .py export that keeps markdown; the downloaded notebook converts exactly like any other .ipynb file.
The classic Jupyter File menu offers downloads as .ipynb, .py, .html, .md and .pdf — the .py entry is the same conversion nbconvert does, and it comments markdown and writes cell markers. Notebook 7 and JupyterLab hide it behind the nbconvert route, which is why a browser converter is often the faster path.
Yes. The # %% markers in the script are the percent format that VS Code's Python Interactive and Jupytext both read: open the .py in VS Code and click “export” above a cell, or run jupytext --to ipynb script.py. The round trip is not pixel-perfect — markdown becomes comments and cannot be fully restored as markdown.
No. The file is read with the browser's File API, parsed as JSON and turned into a script inside the tab. You can disconnect from the network after the page loads and the conversion still works — which is also the practical proof that nothing is uploaded.
Yes, with no account, no file-size gate and no watermark. Conversion runs on your own device, so there is no per-file cost to pass on — same as the site's IPYNB to PDF converter.
Drop it in, download the script, open it in your editor and see how it reads as plain Python — then delete the part of the loop you never liked.
Convert a notebook to PY