This tool extracts code from a Jupyter notebook pasted as JSON, producing a clean script. Code cells become code, markdown cells become comments, and outputs, execution counts, and metadata are dropped. Notebooks are wonderful for exploration and terrible for reuse: a script hidden inside notebook JSON cannot be imported, tested, or run by a scheduler, and outputs bloated with plots make the file hard to share. Stripping converts exploration into a runnable artifact in one paste, which is the first step toward turning a notebook experiment into a reliable script.
How to use it
- Open the notebook JSON (the .ipynb file contents).
- Paste it into the tool.
- Click Strip to code.
- Copy the output into a .py file.
- Run it and fix any order-dependence the notebook hid.
Worked example
A notebook explores sales data: a markdown cell titled “Analysis,” a code cell setting x = 1 and printing it, and a second code cell setting y = 2. Stripping gives a script with the markdown as a comment (“# Analysis”) followed by the three code lines in order. The plots and printed outputs vanish, which is the point: the script now contains the logic, and running it regenerates the outputs instead of carrying stale ones. If the notebook cells were run out of order during exploration, the stripped script exposes that immediately by failing or misbehaving — a bug the notebook’s saved state had hidden.
Honest limits
The tool strips JSON you paste; it does not open .ipynb files from disk, execute code, or preserve widgets, magic commands, or cell metadata that some workflows need. Magic commands like %matplotlib inline survive as plain lines that will fail in a plain script, so review the output for them. It also cannot fix notebook-specific habits: variables defined in a cell that was later deleted, or cells that depend on interactive input, will break as scripts. Stripping is a conversion step, not a guarantee — always run the stripped script and compare its results with the notebook’s.
Who it is for
This tool is for students turning coursework notebooks into scripts, researchers preparing reproducible analysis code, and teams migrating exploratory work into pipelines. Use it at the moment exploration ends and engineering begins.
Going further
After stripping, adopt two habits that keep scripts healthy. First, restart-and-run-all before sharing: a notebook that only works because cells ran in a lucky order is not reproducible, and the stripped script is the honest test of that claim. Second, split the script into functions with clear inputs and outputs instead of one long top-to-bottom flow — the notebook’s cell structure is a natural guide to where functions belong. A stripped, refactored script with a short README explaining its inputs is the form of analysis code that other people can actually reuse, which is the whole point of leaving the notebook behind. After stripping, remove notebook-only artifacts from the script: display calls, inline plotting setup, and variables that only existed because a cell was run twice. Then add a header comment stating the script’s purpose, its inputs, and its expected outputs — the three facts a future reader needs before running anything. A stripped script without that header is only slightly more reusable than the notebook was; with it, the script becomes a tool someone else can run with confidence, which is the real payoff of the conversion. Keep the notebook and the script in sync during transition, or drop the notebook deliberately: two versions of the same analysis that diverge silently are worse than either alone, because nobody knows which one produced a given result. If the notebook stays as the exploratory record, mark it as superseded once the script is authoritative, with a note pointing to the script. A clean handover — notebook archived, script live, pointer between them — prevents the classic confusion of two “current” versions disagreeing.
Related tools
Versión en español · SQL Query Visual Flowcharts · All free online tools.
Embed this tool on your website — free
Copy the code below to add this working tool to your own page. A small credit link stays with it — that’s all we ask.

Pingback: R Script Component Organizer — Free R Section Sorter
Pingback: Extractor de Código de Jupyter Notebook — ipynb a Código Gratis