Notebook output cleaner and source recovery
Remove outputs and execution counts from a local nbformat 4 notebook while preserving cell source, attachments and precise metadata numbers.
- 1Add input
- 2Adjust settings
- 3Get your result
Tool input and files are processed in this browser without being uploaded.
Before you start
Recover code from a notebook made difficult to open by large display outputs. Remove saved output data without rendering it, choose the root widget-state policy explicitly, and download a cleaned notebook plus an indexed source manifest.
How to use this tool
- Open the original .ipynb without rendering its outputs, or paste a small supported notebook.
- Choose whether root widget state should be removed and check the removed-output and execution-count summary.
- Download cleaned.ipynb and cell-sources.json. Open the cleaned copy in Jupyter and verify source/attachments before executing anything.
Supported inputs and limits
One selected UTF-8 .ipynb file up to 64 MiB or pasted JSON up to 8 MiB. Selected file takes precedence. nbformat 4 minor 0–5, at most 200,000 JSON values, depth 128 and 10,000 cells. All downloads together at most 10 MiB; first 200 cells appear in the table. Large retained source/attachments/metadata can still exceed output limits.
Supports code, Markdown and raw cells, plus saved stream/error/display_data/execute_result outputs. Structural fields, unique IDs for minor 5, source representation and recognized metadata fields are validated; duplicate JSON keys, future cell/output types, unknown structural extensions and unsupported format versions reject. Arbitrary custom metadata remains data. Lone surrogate code units in joined cell source reject rather than changing its UTF-8 hash.
Clears every code cell outputs array and sets execution_count to null. The explicit option controls only root metadata.widgets. Source string/array representation, cell order, IDs, CRLF/Unicode, Markdown/raw attachments, other metadata and original large integer/decimal number tokens are preserved. JSON formatting changes; original file is never overwritten.
No MIME rendering, script/cell execution, kernel start or automatic PII removal. Preserved source, attachments, timing/trust/custom metadata may still contain sensitive information. Cell-source JSON retains exact source representation and SHA-256 of joined source encoded as UTF-8; it does not claim the notebook has run or passed tests.
Worked example
Example input
{"nbformat":4,"nbformat_minor":5,"metadata":{"kernelspec":{"name":"python3","display_name":"Python 3"}},"cells":[{"id":"hello","cell_type":"code","metadata":{},"source":["print(\"hello\")\r\n"],"execution_count":1,"outputs":[{"output_type":"stream","name":"stdout","text":["hello\n"]}]}]}Example options
{"secondary":"","params":{"spreadsheetSafe":true,"removeWidgets":true}}Example output
{
"cells": 1,
"codeCells": 1,
"removedOutputs": 1,
"resetExecutionCounts": 1,
"widgetPolicy": "remove root metadata.widgets",
"removedWidgetState": false,
"inputBytes": 288,
"cleanedBytes": 232,
"jsonValues": 21,
"nbformat": 4,
"minor": 5,
"cellReport": [
{
"index": 0,
"type": "code",
"id": "hello",
"sourceBytes": 16,
"sourceSHA256": "f697fb888d89d576cf3e8aecc33581d8c8117b02b2736d55b1e39f85de6c837c",
"removedOutputs": 1,
"executionCountReset": true
}
]
}When something does not work
Use a complete nbformat 4 minor 0–5 file with valid cells, unique minor-5 IDs and supported outputs. Correct duplicate keys or malformed fields in the original producer. If retained content exceeds output limits, split deliberately while preserving required cell relationships. After cancellation, rerun the unchanged original or a smaller valid file.
Frequently asked questions
Is source code removed or executed?
No. Source is preserved as the original string or string array. The tool does not render notebook MIME data, execute cells or start a kernel.
Does removing outputs sanitize every secret?
No. Code, attachments and preserved metadata can contain secrets. The widget option only removes root metadata.widgets; other timing/trust/custom metadata remains.
Why can a 64 MiB input still fail the output limit?
The limit includes the cleaned notebook, source-recovery manifest and reports. Large retained code, attachments or metadata can exceed the combined 10 MiB output budget; failed runs supply no partial download.
Documentation & further reading
Related tools
JSON formatting workspace
Format or minify strict JSON, sort object keys, and encode or decode strings while preserving raw number tokens.
Regex tester
Try a pattern and see what it matches in your text.
Compare text
See what changed, side by side.
HTML formatter
Format HTML indentation so its structure is easier to read.