Markdown TOC Generator
How to use
Paste your Markdown and the table of contents updates automatically. Set the minimum and maximum heading levels to control which headings appear. You can also adjust the indent width and toggle whether to include anchor links. The output is plain Markdown ready to paste at the top of your article.
What is a table of contents (TOC)?
A table of contents is a navigation block placed at the beginning of a long article so readers can scan the structure quickly. Technical writeups and specifications benefit a lot from having one. In Markdown, each entry is a link of the form `[heading](#anchor)`. The anchor is generated automatically from the heading text by the renderer (GitHub, Notion, etc.), and getting that generation rule right is the difference between working links and dead ones.
Anchor (slug) generation rules
GitHub Flavored Markdown follows these rules: 1) lowercase everything, 2) strip punctuation and symbols, 3) replace whitespace with hyphens, 4) for duplicate headings, append `-1`, `-2`, and so on. This tool implements those rules. Non-ASCII headings (Japanese, etc.) are kept as-is, though URL-encoding may apply when the link is followed.
Use cases
- Blog posts — drop a TOC at the top of long technical articles for skimmability
- READMEs — add navigation to GitHub repository docs
- Specs and design docs — surface a structural outline of the document
- Knowledge bases — Notion, Obsidian, HackMD, and similar Markdown-aware editors
- Markdown-based slides — give the audience a structural overview
TOC design tips
- H1 is typically the article title; including only H2 and below in the TOC is conventional
- Skipping H4+ in the TOC and keeping them inline tends to produce a more readable summary
- If non-ASCII anchors look noisy when URL-encoded, give your headings explicit ASCII IDs in your renderer
- Avoiding duplicate heading text prevents `-1` / `-2` suffixes that can break shared links
- Regenerate the TOC after editing — new and renamed headings won't be reflected automatically
Privacy
All processing happens in your browser. The Markdown you paste is never sent to a server.