Markdown table of contents generator

Paste a markdown document and get a linked table of contents built from its headings — with anchor slugs generated exactly the way GitHub does it, so every link works in your README. Nothing leaves your browser.

Generated TOC
- [Getting started](#getting-started)
  - [Prerequisites](#prerequisites)
  - [Installation](#installation)
- [Configuration](#configuration)
  - [Environment variables](#environment-variables)
- [Deployment](#deployment)
- [FAQ](#faq)

How do the anchor links work?

Every heading in rendered markdown gets an HTML id: the text lowercased, spaces turned into hyphens, punctuation dropped, and a -1, -2… suffix added to duplicates. This tool uses github-slugger — the same algorithm GitHub uses — so ## Getting Started! correctly becomes #getting-started. Headings inside code fences are ignored, and markdown formatting inside headings is stripped from the link text.

Where should the TOC go?

Convention: directly under the H1 title, headed “Table of contents” — which is exactly what the Insert into document button does. For long READMEs, limiting depth to H2–H3 keeps it scannable; go deeper only for reference docs. GitHub also auto-generates a TOC in the file header menu, but an inline one still helps readers on npm, crates.io, and anywhere else the README is mirrored.

Related tools

README generator · markdown formatter · how markdown links work · share the finished doc