ipynb to pdf

MD to IPYNB

Markdown to notebook,prose and code in place.

Drop in a .md file and download a valid .ipynb notebook: prose becomes markdown cells, Python fences become code cells, and everything else — including bash and output blocks — stays in the prose. Nothing is uploaded anywhere.

Converted in your browser — the document is never uploaded. You can also drop it anywhere on this page.

  • README.md
  • Quarto
  • MyST
  • Jupytext md
  • nbconvert markdown
  • Any Markdown

0 bytes uploaded

Parsing and notebook assembly happen on your device.

nbformat 4.5 output

The current notebook format every Jupyter tool reads.

```python opens a code cell

Quarto {python} and MyST {code-cell} fences too.

100% of the prose kept

Headings, lists, tables, links and images stay markdown.

What the notebook keeps

Prose as markdown, code as code.

The reader follows the same convention the site's IPYNB to Markdown export writes, so a document and its notebook stay recognisable to each other.

Python fences become cells

A ```python, ```py or ```ipython3 block opens a code cell with the block body copied exactly; Quarto {python} and MyST {code-cell} directives work the same way.

Everything else stays prose

```bash, ```json, output blocks and indented code stay inside the markdown cell exactly as you wrote them — a cell has to be code the Python kernel can run.

Headings, lists and tables intact

Markdown cells pass through untouched, so GitHub tables, images, footnotes and links render in Jupyter the way they render on GitHub.

MyST options handled

Cell options like :tags: [hide-input] are metadata in MyST, not Python, so they are lifted out of the code cell instead of breaking it.

A README becomes a tutorial

Drop in a README with fenced examples and every Python example becomes a runnable cell, in order, with the prose around it — the fastest way from documentation to a live demo.

Deterministic output

Cell ids come from the cell text rather than random, so the same document converts to the same file — and a diff shows content changes and nothing else.

Compatibility

Reads the Markdown your tools already write.

CommonMark runs through as-is; these are the fence forms and edge cases the reader knows about.

Code fences recognised

  • ```python, ```py, ```python3
  • ```ipython / ```ipython3
  • ```{python} (Quarto)
  • ```{code-cell} python (MyST)
  • ```{code-cell} with no language (Python kernel)

Kept as prose

  • fences in other languages (bash, json…)
  • output blocks under a code fence
  • indented code blocks
  • an unclosed fence
  • front matter and HTML blocks

Notebook output

  • nbformat 4.5 with cell ids
  • Python 3 (ipykernel) metadata
  • execution_count: null, no outputs
  • UTF-8 content, any language in prose

Known limits

  • fence languages other than Python stay in markdown
  • outputs cannot be invented — run the cells to fill them
  • relative image paths need the file next to the notebook
  • R and Julia fences are not turned into code cells

How it works

Three steps to a notebook.

Drop in a .md file and download a valid .ipynb notebook: prose becomes markdown cells, Python fences become code cells, and everything else — including bash and output blocks — stays in the prose. Nothing is uploaded anywhere.

  1. 01

    Drop the document in

    Choose a .md file or drag it onto the page; it is read on your device and the notebook is assembled immediately.

  2. 02

    Check the cells

    The preview shows the notebook JSON: markdown cells for the prose, code cells for the Python fences, in document order.

  3. 03

    Download the .ipynb file

    Save notes.ipynb next to your assets and open it in Jupyter, JupyterLab, Colab or VS Code — then run the cells.

Every route from MD to IPYNB

Five ways to turn a Markdown document into a notebook, from the browser converter above to the tooling built into Jupytext, Pandoc and Jupyter itself — pick the one that fits where you already are.

jupytext --to notebook

The command-line standard: jupytext --to notebook notes.md writes notes.ipynb beside it, and --set-formats md,ipynb pairs the two files so every save updates both. It needs Python and an install — the route to choose when the Markdown already lives in a project you control.

pandoc -o notebook.ipynb

Pandoc reads and writes Jupyter notebooks: pandoc -o notebook.ipynb notes.md turns code blocks into code cells and everything else into markdown cells. A single binary with no Python needed — at the cost of Pandoc’s own Markdown dialect.

notedown

The classic small tool for this exact job: notedown notes.md > notes.ipynb turns every fenced or indented code block into a cell. Convenient for scraping a folder of notes; nothing to install behind the converter at the top of this page.

Jupyter's own menus

Jupyter Notebook and JupyterLab open a notebook with File → Open or the upload button; Colab uses File → Upload notebook. That is the second half of every route on this page: the converter produces the file, Jupyter opens it.

In a hurry? Use the converter at the top.

The browser converter above reads the same Markdown as every route on this page and produces the same nbformat 4.5 notebook — with nothing installed and nothing uploaded.

What the notebook keeps (and what it drops)

  • Prose as markdown — headings, lists, tables, links and images as written.
  • Python fences as code — ```python, {python} and {code-cell} blocks.
  • Document order — cells follow the file top to bottom, with nothing reordered.
  • A clean header — a Python 3 (ipykernel) kernelspec and nbformat 4.5 metadata.
  • Other fences as prose — bash and output blocks stay where they were, readable.
  • No outputs — results are re-run, not restored; execution_count stays null.

FAQ

MD to IPYNB: frequently asked questions

Short answers about converting a Markdown document to a Jupyter notebook — which fences become cells, what happens to images, and whether the notebook runs as-is.

How do I convert MD to IPYNB?

Use the converter at the top of this page: choose or drop in a .md file and the browser turns it into a notebook — prose becomes markdown cells, ```python fences become code cells, and the rest stays in the prose. Then download the .ipynb file and open it in Jupyter, JupyterLab, Colab or VS Code. No upload, no install and no terminal involved.

How do I convert a Markdown file to a notebook on the command line?

Run jupytext --to notebook notes.md, which writes notes.ipynb beside it and can pair the two files so every save updates both. Jupytext is a Python package, so it needs an install — this page does the same job in the browser, with nothing to set up.

Which code blocks become cells?

Fences tagged as Python: ```python, ```py, ```python3, ```ipython3, Quarto’s ```{python} and Jupytext’s ```{code-cell} python (or a bare {code-cell}). Every other language and every unlabelled fence — outputs, diagrams — stays inside the markdown cell, because a notebook cell has to be code the kernel can run.

What happens to images and links?

They stay in the markdown cells exactly as written. Relative paths (images/plot.png) resolve from the folder the notebook lives in, so keep the assets next to the .ipynb — remote URLs and data: URLs work with no extra setup.

Can I turn a README into a notebook?

Yes, and it is the most common use: fenced Python examples in a README become runnable cells in order, with the headings and explanations around them as markdown. Blocks in other languages stay as annotations, so the notebook still reads like the README.

Does the converted notebook run as-is?

The code inside the cells is copied unchanged, so yes — run all cells and each block behaves the way it would in a script. There are no stored outputs to begin with, and a cell only works if its imports and variables were set up by earlier cells in the document.

Can I open the result in Google Colab?

Yes. In Colab use File → Upload notebook and pick the .ipynb file. Colab accepts .md files too, but opens them as text — the converted notebook is the version that gets cells, markdown and a kernel.

How is this different from jupytext --to notebook?

Jupytext is the right tool inside a project: it can pair a Markdown file and a notebook so every save writes both. This converter runs in the browser instead — nothing is installed, nothing is uploaded, and it works on any machine, which is useful when a README lands in your inbox and you want a runnable notebook out of it.

Is my document uploaded when I convert it here?

No. The file is read with the browser File API and turned into a notebook inside the tab. You can disconnect from the network after the page loads and the conversion still works — which is also the practical proof that nothing is uploaded.

Does converting IPYNB to Markdown and back restore my original notebook?

Structure survives — markdown cells and the code blocks come back — but the round trip is not a restore: outputs and execution counts are gone (the Markdown never contained them), and a code block only returns as a cell if its fence was tagged with a language the reader knows. Use it to bring documentation into a notebook, not to recover a notebook whose .ipynb file is lost.

Turn that README into a notebook people can run.

Drop it in, download the .ipynb and open it — the prose is already laid out; run the examples and the documentation becomes a live demo.

Convert Markdown to IPYNB