Jul 27 2022 · Aleksandra Płońska, Piotr Płoński

The 3 ways to export Jupyter Notebook to HTML

Export Jupyter Notebook to HTML bannerThe HTML representation of the Jupyter Notebook is very useful for sharing with non-technical users. The HTML can be served as a static website or even send by email. It is an universl format. You can open HTML file on any device with web browser application. What is more, the HTML that is constructed from executed Jupyter Notebook is packed in a standalone file, so you don't need to send additional files with assets. I would like to show you 3 ways to convert Jupyter Notebook to HTML.

1. Download Jupyter Notebook as HTML

The most strightforward way to get HTML file from Jupyter Notebook is to use Download as function inside the Jupyter application. Please click on File in the top navigation bar, and then Download as to see many options of download formats (PDF, HTML, Python, LaTeX). Please select HTML (.html). The notebook application will start download automatically. You can open your local HTML file as a web page. Please see example in the screenshot video below.

Jupyter Notebook download as HTML

2. Convert Jupyter Notebook to HTML with nbconvert

There is an amazing tool nbconvert for converting Jupyter Notebook into different formats. It can work as a command line tool or Python API. It can export notebook into many formats: PDF, HTML, LaTeX, Reveal.js. You can check the list of supported formats in the nbvoncert documentation. The nbconvert is installed with Jupyter Notebook application. The Jupyter application is using it internally in its Download as feature.

The convertion of the notebook ipynb file to html can be done with one command:

jupyter nbconvert --to html my-notebook.ipynb

The above command will create HTML file with name my-notebook.html. The big advantage of nbconvert over GUI apporach for downloading Jupyter Notebook as HTML is that we can easily select what parts of the notebook will be exported. For example, we can easily export only outputs of cell execution, so we will share in HTML only results (code will be not present in the HTML).

jupyter nbconvert --to html --no-input my-notebook.ipynb

3. Make interactive HTML from Notebook with Mercury

The Mercury framework convert Jupyter Notebook into interactive HTML. You can easily serve Jupyter Notebooks as web pages with Mercury. What is more, you can use Mercury to parametrize the notebook. You can add interactive widgets to the notebook based on the YAML header inserted at the top of the notebook. When you share notebook as web page, your end-users will be able to tweak widgets values and execute your notebook with new parameters. The resulting notebook can be downloaded as HTML standalone file with one click.

Below is an example notebook with YAML header. The YAML defines three widgets that will be added to the notebook. What is more, the code is removed from the output HTML with show-code: False parameter.

Jupyter Notebook with Mercury YAML header

The widgets values can be changed and the notebook will be executed with new values after the Run button is clicked. The resulting notebook can be downloaded as HTML file.

Mercury convert Jupyter Notebook to web app

The Mercury framework is open-source, with code available on the GitHub. Users that needs advanced features, dedicated support and customization can purchase commercial license.


The Jupyter Notebook is a great tool. It has many use cases. Exported notebook to standalone HTML file can be easily shared with non-technical users. The easiest solution is to use Jupyter application function Download as. The automated process of conversion can be done with command line nbconvert tool. It also provide advanced export options. The Mercury framework can used to easily convert notebook to web page with interactive widgets.