Markdown TOC Generator

Paste your Markdown and get a linked table of contents with GitHub-compatible anchors instantly.

Ad ยท 728ร—90
Markdown Input
TOC Preview
๐Ÿ“‘TOC will appear here
Ad ยท Responsive

What is a Markdown TOC Generator?

A table of contents (TOC) is a list of linked headings at the top of a document that lets readers jump to any section. In Markdown, a TOC is built from a nested list of links pointing to heading anchors โ€” for example, - [Introduction](#introduction). On GitHub, GitLab, and most Markdown renderers these links navigate directly to the corresponding heading.

Building a TOC by hand is tedious, especially as your document grows. This tool extracts all headings from your Markdown, generates the correct anchor slugs (matching GitHub's algorithm: lowercase, spaces to hyphens, special characters stripped), and outputs a ready-to-paste nested list. You can filter by heading depth, switch between bullet and numbered lists, and use Insert into doc to place the TOC directly after the first H1 in your document.


How to Use

  1. Paste your Markdown document into the left panel.
  2. The TOC appears instantly on the right. Use the Preview tab to see the interactive tree, or Markdown for the raw output to copy.
  3. Adjust Min / Max level to include only the heading depths you want.
  4. Toggle Numbered list for ordered numbering instead of bullets.
  5. Click โฟป Copy TOC to copy the Markdown TOC, or โ†ฉ Insert into doc to inject it into your document automatically.

Frequently Asked Questions

GitHub's anchor algorithm converts a heading to lowercase, replaces spaces with hyphens, strips all characters except letters, numbers, hyphens, and underscores, and removes leading/trailing hyphens. For example, ## Getting Started (v2) becomes #getting-started-v2. If the same slug appears more than once, a counter suffix is added: #getting-started, #getting-started-1, #getting-started-2, etc. This tool implements that algorithm exactly.

It inserts the generated TOC into your input document. If the document contains an H1 heading, the TOC is placed immediately after the first H1 line (a common convention). If there is no H1, it is inserted at the very top. Any existing <!-- TOC --> โ€ฆ <!-- /TOC --> block is replaced. The result appears in the input panel so you can copy the full updated document.

No. This tool runs entirely in your browser. Your Markdown is never sent to any server, never logged, and never stored. Closing the tab removes all data immediately.

Ad ยท Responsive