nbconvert is a powerful command-line tool for converting Jupyter notebooks into other formats such as HTML, PDF, Markdown, LaTeX, slides, and more. It supports exporting, cleaning, and customizing output, making it ideal for documentation, presentations, and reporting.

Typical Use Cases

1. Printing or Exporting Without Code

Useful for creating clean reports or meeting documents without code cells:

jupyter nbconvert stock_analysis.ipynb --no-input --to pdf
jupyter nbconvert phi_analysis.ipynb --to html --no-input --no-prompt

Alternatively, using the TemplateExporter class:

jupyter nbconvert Querying.ipynb --to html --TemplateExporter.exclude_input=True

See: Stack Overflow – Hide Code When Exporting

2. Converting to Reveal.js Slides: Reveal.js

Turn a notebook into an interactive slideshow: See nbconvert slideshows

jupyter nbconvert notebook.ipynb --to slides --post serve
  • Each cell becomes a slide (if marked with slide metadata).
  • Opens a Reveal.js-based presentation in your browser.

To see possible themes see: https://revealjs.com/themes/

Best themes:

  • serif

Additional Capabilities

FormatCommand exampleDescription
HTML--to htmlDefault HTML export
PDF--to pdfExport to print-friendly format (requires LaTeX)
Markdown--to markdownConvert for static blog/docs integration
Python script--to scriptConvert notebook to plain .py script
LaTeX--to latexGenerate LaTeX report for academic use
Slides--to slides --post serveInteractive Reveal.js presentation

Common Options

OptionPurpose
--no-inputHide code cells (inputs)
--no-promptHide In [ ]: and Out [ ]: prompts
--clear-outputRemove all outputs from the notebook
--output new_nameSet a custom name for the output file
--TemplateExporter.exclude_input=TrueTemplate-based approach for hiding inputs