Skip to content

How to Convert .ipynb to HTML

Published on

Updated on

Convert a Jupyter Notebook to HTML fast: run jupyter nbconvert --to html notebook.ipynb. nbconvert ships with Jupyter, so no extra install. Includes Jupyter UI, VS Code, Colab, online converters, and fixes for huge file size and widgets.

A .ipynb file is a Jupyter Notebook: JSON that bundles your code, outputs, charts, and markdown. Exporting it to HTML turns that into a single, self-contained web page anyone can open in a browser — no Python, no Jupyter, no kernel — which makes HTML the easiest way to share, host, or embed a notebook.

Quick answer

The fastest way to convert a notebook to HTML is nbconvert, which ships with Jupyter (no extra install):

jupyter nbconvert --to html notebook.ipynb

That writes notebook.html in the same folder — a standalone page with the CSS, images, and outputs embedded, so it works offline and on any device. If you would rather not touch the command line, every notebook environment can export HTML too. Pick the method that matches what you already have:

MethodInstall neededBest for
nbconvert --to htmlJupyter (built in)Scriptable, reproducible exports
Jupyter UI exportNothing extraOne-off export from the notebook you're in
VS Code exportVS Code + Jupyter ext.People already coding in VS Code
Google ColabNothing (cloud)Notebooks already in Colab
Online converterNothingNo local Python at all

Method 1: nbconvert (the canonical way)

nbconvert is the official Jupyter export tool. It comes with Jupyter Notebook, JupyterLab, and the Anaconda distribution, so if you can run notebooks you already have it — no new packages required:

jupyter nbconvert --to html notebook.ipynb

You'll find notebook.html in the same directory. It's a self-contained page with embedded CSS, JavaScript, and base64-encoded images, so Matplotlib and Seaborn charts render exactly as they did in the notebook, and the file works even when opened offline.

A few useful variations:

# write the output somewhere specific
jupyter nbconvert --to html notebook.ipynb --output-dir ./public
 
# hide the input code cells, keep only outputs (great for reports)
jupyter nbconvert --to html --no-input notebook.ipynb
 
# leaner page that links assets instead of inlining everything
jupyter nbconvert --to html --template lab notebook.ipynb

If the command itself isn't found, see Tips & troubleshooting.

Method 2: Export from the Jupyter UI

Inside JupyterLab or the classic Notebook interface you never need the terminal:

  • JupyterLab: File > Save and Export Notebook As… > HTML
  • Classic Notebook: File > Download as > HTML (.html)

Either way, Jupyter quietly calls nbconvert under the hood and hands you the downloaded .html file. This is the quickest path when you're already looking at the notebook you want to export.

Method 3: Export to HTML in VS Code

If you edit notebooks in Visual Studio Code with the Jupyter extension:

  1. Open the .ipynb file in VS Code's notebook editor.
  2. Click the ... (More Actions) menu at the top of the notebook.
  3. Choose Export and select HTML.
  4. Pick a save location.

No separate extension is needed — the Jupyter extension bundled with the Python tooling handles the conversion through nbconvert.

Method 4: Google Colab

Colab does not have a first-party "Export to HTML" button yet, but you have two easy options:

  • Download, then convert locally: File > Download > Download .ipynb, then run jupyter nbconvert --to html notebook.ipynb (or use an online converter).
  • Run nbconvert in a Colab cell so everything stays in the browser:
!jupyter nbconvert --to html notebook.ipynb

The generated file appears in Colab's file browser (folder icon on the left); right-click it to download.

Method 5: Online converters

When you have no local Python at all, an online converter handles everything in the browser. Upload the .ipynb, pick HTML, and download the result.

RunCell (opens in a new tab) offers a free ipynb-to-HTML converter that runs client-side — the notebook is processed in your browser and never uploaded to a server, which makes it the privacy-friendly choice for work or sensitive notebooks. Plots are embedded as images so charts render just like in Jupyter.

Runcell online ipynb to html converter (opens in a new tab)

Other general-purpose options include Vertopal and CoolUtils, which upload your file to their servers before converting. Avoid sending notebooks that contain credentials, private data, or proprietary code to third-party sites.

Tips & troubleshooting

jupyter: command not found or nbconvert: command not found

nbconvert isn't installed or isn't on your PATH. Install it and call it through Python to be safe:

pip install nbconvert
python -m jupyter nbconvert --to html notebook.ipynb

The HTML file is huge

Notebooks with many plots inflate quickly because images are embedded inline as base64. To shrink the output:

  • Lower the figure resolution before exporting, e.g. plt.savefig(..., dpi=80) or set plt.rcParams["figure.dpi"] = 80.
  • Use --no-input to drop code cells if readers only need the results.
  • Use --template lab (or --template basic) for a lighter HTML shell.

Interactive widgets (Plotly, ipywidgets) look static

nbconvert embeds widget output when the data is saved in the notebook. Plotly figures usually stay interactive; richer ipywidgets often degrade to a static snapshot in a plain HTML export. Make sure the widget state is saved (Widgets > Save Notebook Widget State in Jupyter) before converting, and re-run all cells so the latest output is captured.

Convert many notebooks at once

Loop over the folder in your shell:

for f in *.ipynb; do jupyter nbconvert --to html "$f"; done

Some cells are missing from the output

nbconvert exports the saved notebook, not the live kernel. Run all cells and save the notebook before converting so the latest outputs are included.

FAQ

What is the command to convert ipynb to HTML?

Run jupyter nbconvert --to html notebook.ipynb. nbconvert ships with every standard Jupyter install, so no extra package is needed. The output is a self-contained notebook.html.

Do I need to install anything to convert ipynb to HTML?

No. If you can run Jupyter notebooks, nbconvert is already installed. You can also export to HTML from the Jupyter UI, VS Code, or an online converter without touching the command line.

Should I export to HTML or PDF?

HTML is responsive, searchable, and easy to embed in blogs or dashboards, and it keeps interactive plots and copy-pastable code. Choose PDF when you need a fixed, printable document — see our guide on converting .ipynb to PDF.

How do I convert ipynb to HTML in Google Colab?

Colab has no direct HTML export. Either download the notebook (File > Download > Download .ipynb) and run nbconvert locally, or run !jupyter nbconvert --to html notebook.ipynb in a Colab cell and download the file from the file browser.

My HTML file is too large — how do I shrink it?

Inline images are usually the cause. Lower figure DPI in the notebook (plt.savefig(..., dpi=80)), drop input cells with --no-input, or use a lighter template such as --template lab.

Related Guides