Skip to content

Markdown Table of Contents Generator

Generate a linked table of contents for a README or docs page from its headings, with GitHub-compatible anchors, and insert it into the document.

Markdown Table of Contents GeneratorFreeNewMarkdownRuns in your browser

0 words · 0 characters · 0 lines

Anchors follow GitHub's rules, so links work on GitHub, GitLab and most docs sites. The TOC sits between <!-- toc --> markers; paste the updated document back in to refresh it.

Works in your browser. What you paste or upload is processed on your device.

Key features of the Markdown table of contents generator

  • GitHub-compatible heading anchors with duplicate handling
  • Choose the heading range (H1–H6)
  • Bulleted or numbered, linked or plain
  • Insert into the document between <!-- toc --> markers
  • Ignores headings inside code blocks and front matter
  • Copy the TOC or download the updated file

How to use the Markdown table of contents generator

  1. Paste the Markdown

    Paste your README or docs page, or open the .md file.

  2. Choose the levels

    Set From heading and To heading, for example H2 to H3.

  3. Copy the TOC or the document

    Copy the TOC from the first tab, or take the whole document with the TOC inserted from the second tab.

  4. Update later

    When headings change, paste the document back in; the TOC between the markers is replaced.

What is a Markdown table of contents generator?

A Markdown table of contents (TOC) generator reads the headings in a Markdown document and writes a nested list of links to them, so readers can jump to any section of a long README or docs page. Paste the Markdown and the TOC appears; a second tab shows the whole document with the TOC inserted.

Anchors follow GitHub's rules: lower case, punctuation removed, spaces turned into hyphens, and repeated headings numbered -1, -2 so every link points to the right place. The same anchors work on GitLab, Bitbucket and most docs generators. Choose which heading levels to include (H2 to H3 by default; the document title H1 is skipped), whether the list is bulleted or numbered, and whether entries are links.

The inserted TOC sits between <!-- toc --> and <!-- tocstop --> comments, the same markers used by markdown-toc, so you can paste the updated document back later and regenerate only that block. Headings inside code blocks are ignored, and YAML front matter is skipped.

Why use a Markdown table of contents generator?

Long READMEs and docs pages are hard to scan. A linked TOC helps readers find the install, usage or API section quickly, and GitHub's own outline button is easy to miss.

Markdown table of contents generator: frequently asked questions

Something else? Ask the team

How do I add a table of contents to a GitHub README?

Paste the README here, open the Document with TOC tab, and copy it back into README.md. The TOC is placed after the title and links to every H2 and H3.

How are the anchor links created?

Like GitHub: the heading text in lower case, punctuation removed and spaces replaced with hyphens. A second heading with the same text gets -1, a third -2.

Why skip the H1?

The H1 is normally the document title, so a link to it isn't useful. Set From heading to H1 if your document has several H1 sections.

Does GitHub generate a TOC automatically?

GitHub shows an outline menu on README files, but it isn't part of the file and doesn't appear on other sites or in exported copies. A TOC in the Markdown works everywhere.

What are the <!-- toc --> comments?

Invisible markers around the generated TOC. They let this tool, and tools like markdown-toc, find and replace the TOC when you regenerate it.

Want to win more AI citations?

Markdown Table of Contents Generator is one piece of the puzzle. See how ChatGPT, Gemini, Perplexity, and Google AI Overviews actually view your brand, and get a prioritised list of fixes, with a free AEO & GEO audit from AI Rank Lab.

One check is a start. The audit checks the whole site.

Run a free AEO & GEO audit or View pricing.

  • Scores SEO, answer-engine (AEO) and generative-engine (GEO) readiness
  • Lists the fixes, page by page
  • Then track whether ChatGPT, Gemini, Perplexity and Google AI Overviews cite you
fieldnote.app4,571 credits

Site audit

fieldnote.app · SEO, AEO and GEO

Illustrative data
SEO
82
+6
AEO
64
+11
GEO
58
+9
Pages
48
Fixesby impact
  • /pricing · Missing H1High
  • /blog/guide · No FAQ schemaMedium
  • /llms.txt · Not foundMedium
  • /about · Meta description too longLow

See where your whole site stands

Paste your site. The free audit scores it for SEO, answer engines and generative engines, with the fixes.