Markdown TOC Generator

Build a table of contents from any Markdown document — Paste text or drop in a .md file, and the tool extracts every heading and emits a GitHub-compatible nested Markdown list (anchors use GitHub slug rules: lowercase, spaces → hyphens, #<> stripped, Chinese kept as-is) or a copy-ready HTML <nav> list. Fenced code blocks are ignored, duplicate headings get -1/-2 suffixes, and you can insert the TOC right at the cursor of your source or download it as .md / .html. Everything runs locally in your browser — no upload, no server.
File:
Drop a Markdown file here, or click to choose
.md / .markdown / .txt — up to 200 MB (or paste below)
No text?
TOC Options
Paste Markdown text or choose a file to begin.
Markdown TOC
Notes: Headings are read with a full Markdown parser, so # inside fenced code blocks or indented code is never counted, and inline formatting such as *emphasis*, `code` or [links] is stripped from the anchor text. Anchors follow GitHub slug rules (CJK is preserved). Repeated headings get -1, -2... suffixes. For README files, use the Markdown list output; for web pages, switch to HTML <nav>. Insert at cursor places the current TOC back into your source text at the caret position.
Headings are the outline

A table of contents is generated from heading lines alone — the hierarchy comes from # depth, nothing else. Each entry links to an anchor slug derived from the heading text, so renaming a heading silently breaks existing links that point at its old slug. A TOC pasted into a file also ages: add a heading, and the pasted list no longer matches the document.

Regenerate after editing headings — a pasted TOC is a snapshot.