Skip to main content
markdowntoctable of contentsdocumentationgithubwebdevtoolbox

How to Use the Markdown TOC Generator — WebdevToolbox Guide

Paste markdown with headings and generate a GitHub-style table of contents with anchor links, in bulleted or numbered format.

WebdevToolbox Team2 min read

A long README or documentation file is much easier to navigate with a table of contents — but hand-writing anchor links that exactly match GitHub’s auto-generated heading slugs, and keeping them in sync as headings change, is tedious. This tool generates both instantly.

What Is the Markdown TOC Generator?

Paste markdown containing #-style headings, and get a correctly indented, linked table of contents using GitHub’s own heading-anchor slug algorithm — so the links actually work when pasted into a README rendered on GitHub.

How to Use It

  1. Open the tool at /tools/markdown-toc-generator.
  2. Paste your markdown document (or edit the default sample).
  3. Choose a max heading depth and bulleted or numbered format.
  4. Copy the generated TOC and paste it near the top of your document.

Key Features

  • GitHub-compatible anchor slugs, matching the exact lowercase/strip/hyphenate algorithm GitHub uses for its own auto-linked headings.
  • Duplicate-heading handling, appending -1, -2, etc. just like GitHub does for repeated heading text.
  • Code-fence awareness, ignoring # characters inside fenced code blocks so they aren’t mistaken for real headings.
  • Adjustable depth and numbering, to match the exact TOC structure you want.

When to Use This Tool

  • Adding a table of contents to a long README or documentation page before publishing.
  • Regenerating a TOC after restructuring or renaming headings in an existing document.
  • Double-checking that your manually written anchor links match GitHub’s actual generated slugs.

Try It Now

Open Markdown TOC Generator directly, or press ⌘K and type the tool name from anywhere on the site.


Part of the Text & Writing collection on WebdevToolbox — free, browser-based developer tools with no login required.

Tagged with

markdowntoctable of contentsdocumentationgithubwebdevtoolbox

Related posts