Pre-launch version

Markdown TOC Generator

Paste Markdown or drop a .md file to get a nested table of contents with GitHub-compatible anchor links — ready to copy back into your document.
Your file never leaves your device.

How do you want to add your Markdown?

Paste or upload Markdown to generate a table of contents.

About the Markdown TOC generator

GitHub-compatible anchors

Anchors follow GitHub's own slug rule: the heading text is lowercased, punctuation is dropped, and each remaining space becomes a hyphen. That means the links this tool emits resolve correctly when you paste the table of contents into a README on GitHub or GitLab — including the details that are easy to get wrong, like punctuation between two words leaving a double hyphen behind. Repeated headings get GitHub's -1, -2 suffixes in document order, so two sections both called "Overview" link to the right places.

Both heading styles are found

ATX headings (## Heading) and setext headings (text underlined with === or ---) are both collected. Setext is easy to miss — an underline of dashes is indistinguishable from a horizontal rule unless you look at the line above it — so the check is shared with our formatter and linter to guarantee all three agree. Headings inside fenced or indented code blocks are ignored, as is anything in YAML front matter.

Nesting follows your document

Indentation is measured from the shallowest heading actually present, so a document whose sections start at ## produces a flat top-level list rather than one pointlessly indented. Deeper headings nest underneath. Everything runs locally in your browser — the document is read on your own device and nothing is uploaded or stored.

Generate without uploading — your file never leaves your device

This tool runs entirely in your browser using JavaScript. Your Markdown is never uploaded to a server, never stored, and never leaves your device — so drafts, notes, and documents stay private.

Frequently asked questions

Will the links work on GitHub?
Yes — the anchors are generated with GitHub's slug rule, so pasting the table of contents into a README produces working links. That includes matching GitHub's quirks exactly: a heading like "Setup — part one" produces a double hyphen where the dash was, because that is what GitHub generates.
Does it find underlined (setext) headings?
Yes. Both # headings and headings underlined with === or --- are collected. The same underline-versus-horizontal-rule check is shared with Format Markdown and Lint Markdown so all three tools agree on what counts as a heading.
What about duplicate headings?
They get GitHub's numeric suffixes in document order — the first "Overview" links to #overview, the second to #overview-1 — which is exactly how the renderer resolves them.
Is there a download?
No — a table of contents is a snippet you paste back into your document, not a file you keep. There's a copy button; the output box is also selectable if you prefer.
Are headings inside code blocks included?
No. Fenced and indented code blocks are skipped, so a # line inside an example is never mistaken for a heading. YAML front matter is skipped too.
Does this upload my file?
No. Generation runs entirely in your browser with JavaScript — your Markdown is never sent to a server and never leaves your device.

More Markdown tools, coming soon

Markdown to PDF, merging, splitting, and more — all free and all in your browser.

Back to all tools →