Compare two Jupyter notebooks
nbview shows what changed between two .ipynb files, cell by cell, in the browser. Neither notebook is uploaded: each one is read from GitHub, a gist or a link by the browser that is showing it.
How to compare
- Open nbview’s compare page, or choose Compare in the toolbar of any notebook you already have open.
- Paste a link to each notebook, or pick two
.ipynbfiles from your disk. The two can sit in different repositories, branches or folders. - Read the diff. Each changed cell is shown with the version it came from, and a swap button above it flips the two sides.
A link can carry the comparison itself, so a review comment or a class note can point at it. The # is part of the address: the viewer routes on it, so a link without one lands on the home page.
/#/compare/github/{owner}/{repo}/{older}...{newer}/{path}.ipynb
/#/compare/links/{first-notebook-link}/{second-notebook-link}
What the diff shows
- Cells that were added, removed or modified, kept in their original order so the story of the notebook still reads top to bottom.
- Line-level changes inside a modified code cell, rather than the whole cell marked as replaced.
- Changed outputs, once Show output changes is pressed. A cell whose code is identical but whose printed result, table, chart or traceback differs then shows up as a change, which is often the only evidence that a run went differently.
- Markdown edits, next to the code edits, in the same view.
Private repos, and notebooks on your disk
Files you choose from your disk are read in the page and never leave the browser. Private repositories work once a fine-grained GitHub token with Contents: Read-only is saved: the token stays in this browser and is sent only to api.github.com.
How this compares with other notebook diffs
| Tool | Where it runs | What it needs |
|---|---|---|
| nbdime | On your machine, as a Python package, CLI or JupyterLab extension | The notebooks already downloaded, plus a Python install |
| ReviewNB | As a GitHub App, on pull requests | Install access to the repositories you want to review |
| nbview | In the browser, given two links or two files | No install or app; public notebooks need nothing, private ones a read-only token |
nbview is a free, open-source notebook viewer. It is an independent project and is not affiliated with Project Jupyter or nbviewer. Open the viewer, read the README, or see what changed, or read the privacy note.