Markdown table of contents generator

Paste a Markdown document and get a nested table of contents with anchor links that match the slug rules GitHub uses — lowercased, spaces to hyphens, punctuation stripped, duplicates suffixed. Fenced code blocks are skipped so commented-out headings do not appear.

Only ATX headings outside fenced code blocks are considered, so a '#' inside a bash comment or a Python string is ignored. Anchors are deduplicated in document order, which is how GitHub numbers its repeats.

Runs entirely in this tab. Nothing you paste is uploaded, logged or stored — close the page and it is gone.

Questions about this tool

Which heading levels are included?

All six by default, nested as an unordered list. You can cap the depth if you only want the top two levels, which is usually what a README needs.

Why does an anchor end in -1?

Because that heading text already appeared earlier in the document. GitHub suffixes duplicates with -1, -2 and so on, and the generator follows the same rule so the links resolve.

Are headings inside code blocks counted?

No. Fenced blocks are skipped, so a shell comment or a string containing '#' does not turn into a table of contents entry.

AI alternatives from the directory

Browse productivity tools →

This utility handles the job by hand. These do it with a model — worth a look when the task outgrows copy and paste.

Notion AI logo
Notion AI
Productivity
☆

AI that lives inside your workspace

Draft, summarize and query your Notion docs with built-in AI, from meeting notes to knowledge bases.

Gamma logo
Gamma
Productivity
☆

AI presentations, docs and webpages

Generate polished decks and one-pagers from a prompt, with instant restyle and built-in hosting.

☆

Chat with your own documents, then hear the summary

NotebookLM — now branded Gemini Notebook — grounds every answer in the sources you upload, cites the exact passage, and