ipynb to pdf

IPYNB to PY

Notebook to Python script,in one drop.

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.

  • Jupyter Notebook
  • JupyterLab
  • Google Colab
  • VS Code
  • Kaggle
  • Deepnote

0 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

Code first, everything else preserved.

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.

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.

Markdown as comments

Markdown cells become # comment lines, so headings, lists and links stay readable in the script without breaking Python syntax.

# %% cell borders

Cells are separated with the same percent-format markers nbconvert and Jupytext write, so VS Code can turn the script back into a notebook.

Cells in order

The script follows the notebook top to bottom, so the execution order you tuned in Jupyter is the order the file runs in.

Ready for git and CI

A plain-text .py file diffs, reviews and runs in a terminal or a pipeline — places where an .ipynb file is at best awkward.

No outputs, by design

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

Reads every notebook you can throw at it.

Notebooks from Jupyter Notebook, JupyterLab, Google Colab, Kaggle, Deepnote and VS Code all convert, including the older nbformat 3 files.

Notebook formats

  • nbformat 4 (current)
  • nbformat 3 worksheets (legacy)
  • attachments ignored safely
  • UTF-8 content, any language

Cell types

  • code cells pass through untouched
  • markdown cells as comments
  • raw cells as comments too
  • empty cells skipped quietly

Where the script goes

  • run: python script.py
  • review: git diffs a plain text file
  • edit: any editor or IDE
  • back to notebook: VS Code or Jupytext

Known limits

  • magic commands (%matplotlib) stay as written
  • shell lines (!pip install) stay as written
  • outputs are not carried over
  • interactive widgets have no script form

How it works

Three steps to a Python script.

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.

  1. 01

    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.

  2. 02

    Check the script

    Code cells appear unchanged with # %% borders; markdown cells are visible as comments, so nothing from the notebook is lost.

  3. 03

    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.

Every route from IPYNB to PY

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.

jupyter nbconvert --to script

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, for two-way conversion

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.

VS Code export

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

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.

Jupyter's own menus

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.

What the script keeps (and what it drops)

  • Code as code — every code cell copied unchanged, in notebook order.
  • Markdown as comments — prose stays readable between cell markers.
  • # %% markers — the percent format VS Code and Jupytext turn back into notebooks.
  • A clean header — the source file name and nbformat for provenance.
  • No outputs dropped silently — plots and tables are left out deliberately; re-run to regenerate.
  • Magics kept as written — %matplotlib and !pip lines are quoted verbatim; comment them out to run the script.

FAQ

IPYNB to PY: frequently asked questions

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.

How do I convert IPYNB to PY?

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.

How do I convert a Jupyter notebook to a Python file on the command line?

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.

What happens to markdown cells when converting IPYNB to PY?

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.

Does the converted .py file run as-is?

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.

How is this different from jupyter nbconvert --to script?

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.

Why convert a notebook to a Python script at all?

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.

How do I convert IPYNB to PY in VS Code?

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.

How do I convert a Google Colab notebook to a Python script?

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.

Why is there no .py export button in Jupyter?

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.

Can I turn the script back into a notebook?

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.

Is my notebook uploaded when I convert it here?

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.

Is the IPYNB to PY conversion free?

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.

Try it with the notebook you keep meaning to refactor.

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