IPYNB to Python Converter

Local JSON parsingCode cells onlyNo execution

Extract notebook code cells into a clean .py script for Git diffs, reuse, reviews, or class submissions.

student-score-analysis.ipynb

Script options

student-score-analysis.py

Sample preview is loaded. Upload a notebook to replace it.

Code cells
2
Markdown cells
1
Output cells
2

Monokai-inspired preview

Light code preview of the generated .py file. Full script downloads below.

.py
# Generated by IPYNB Tools IPYNB to Python Converter# Source: student-score-analysis.ipynb# Code cells extracted: 2# Notebook outputs are not preserved in .py scripts. Run the script to recreate results. # %% Cell 1import pandas as pdscores = pd.DataFrame({"score": [82, 91, 76]})scores.mean() # %% Cell 2scores["passed"] = scores["score"] >= 80scores 
Tool page

IPYNB to PY Converter Online

Check how the converter separates source code, optional Markdown comments, and excluded outputs before you download the script.

Local conversion

The notebook JSON is parsed in your browser for this code extraction workflow.

Code cells only

The .py output contains source code cells; rich outputs are not preserved.

No execution

The converter does not execute Python, shell commands, notebooks, or external dependencies.

Notebook cells become a Python script

The converter reads saved notebook JSON, keeps code cell source, and writes a .py script with optional # %% cell markers. Outputs, charts and tables are not copied into the script.

.ipynb cells

Markdown cell

Optional context comments

Code cell 1

import pandas as pd

Saved output

Excluded from .py

Code cell 2

scores["passed"] = scores["score"] >= 80

.py script

# %% Cell 1
import pandas as pd
scores = pd.DataFrame(...)
# %% Cell 2
scores["passed"] = scores["score"] >= 80

Example notebooks for Python extraction

These sample notebooks show the kinds of code-first notebooks that are safe to inspect as scripts.

What is preserved in .py output

A Python script is a source-code artifact. Review this matrix before choosing .py instead of PDF.

Before You Download

Review the extracted script before using it. Notebook cells may depend on hidden state, previous execution order, magics, shell commands, or files that were available only in the original notebook environment.

  • Check imports
  • Review cell order
  • Replace notebook magics when needed
  • Run in a clean environment
Code cells
Preserved
Source text is copied in notebook order.
Cell boundaries
Optional
Keep # %% cell markers for VS Code or notebook-style editors.
Markdown cells
Optional
Include them as # comments when context matters.
Notebook outputs
Not preserved
Rendered outputs are display data, not Python source.
Charts and tables
Not preserved
Use IPYNB to PDF when charts and tables must remain visible.
Magics or shell commands
Copied as text
Review % and ! commands before running the script outside Jupyter.

HowTo

Notebook to Python script workflow

Use this visible workflow to match the generated .py file with the original notebook structure before you reuse the code.

  1. 1

    Upload a saved .ipynb notebook

    Choose a Jupyter Notebook file from your device.

  2. 2

    Review detected cells

    Check the detected code cells, markdown cells, and output cells before downloading.

  3. 3

    Choose script options

    Keep # %% cell markers and optionally include markdown as comments.

  4. 4

    Download the .py file

    Download the extracted Python script or copy the code.

When to choose IPYNB to PY

Use the .py output when the next step is editing, reviewing, or running source code outside the notebook UI.

Best for

  • Best for Git diffs when reviewers need Python source instead of notebook JSON.
  • Best for moving working analysis code into a script-first project structure.
  • Best for classroom or code review submissions that ask for source code.

Not for

  • Not for final reports with charts, tables, and saved outputs; use IPYNB to PDF instead.
  • Not for reproducing a notebook environment automatically; dependencies and execution order still need review.
  • Not for preserving widgets, images, rich display data, or execution counts.

Specs and limitations

IPYNB Tools · Code extraction for notebooks

IPYNB Tools editorial · Updated May 16, 2026

Local JSON parsingCode cells onlyNo execution
Input
.ipynb Jupyter Notebook
Output
.py Python script
Best for
Git diffs, source review, reuse
Input
Standard .ipynb Jupyter Notebook JSON files.
Output
A .py Python script generated from code cells.
Markdown
Optional markdown comments can be included for context.
Execution
Notebook code is not executed.
Outputs
Notebook outputs are not preserved in the script.
Best fit
Code extraction, Git review, reuse, and script migration.

FAQ

What does the IPYNB to Python converter extract?

It extracts notebook code cells from a saved .ipynb file and combines them into a downloadable .py script. Markdown cells can optionally be included as Python comments.

Can I convert IPYNB to PY online?

Yes. Upload a saved .ipynb file, review the extracted code preview, then download the generated .py script. The page reads notebook JSON for code extraction and does not execute notebook code.

Are notebook outputs, charts, and tables preserved?

No. A Python script stores code, not rendered notebook outputs. Charts, tables, rich display results, execution counts, and widgets are not preserved in the .py file.

Does this run my notebook code?

No. The converter reads the notebook JSON and extracts source text only. It does not execute Python, shell commands, notebooks, local files, or external dependencies.

When should I use PDF instead of Python?

Use IPYNB to PDF when the reader needs saved outputs, charts, tables, formulas, or a fixed homework/report artifact. Use IPYNB to Python when the next step is source-code review, reuse, Git diff, or script migration. If you are choosing between notebook and script output, use the IPYNB vs PY comparison.

Does it keep # %% cell markers for VS Code?

Yes, cell markers are enabled by default. The generated script can include # %% cell markers so VS Code and notebook-style script editors can navigate extracted cells.

What happens to notebook magics or shell commands?

Magics or shell commands are copied as source text when they appear inside code cells. Review lines beginning with % or ! before running the .py script outside Jupyter.