Markdown table of contents generator
Paste a README or a long Markdown file. You get a linked contents list whose anchors match the ones GitHub puts on each heading.
Table of contents
Paste Markdown with headings and the contents list appears here.
How to use it
- Paste your Markdown. Headings inside code blocks are skipped.
- Choose which levels to include (from
##to###suits most READMEs) and bullets or numbers. - Copy the list, or copy the whole document with the list placed after the main title.
How GitHub builds heading anchors
Every heading on GitHub gets an id you can link to with #. The tool uses the same rule, so its links land where GitHub expects.
- Letters are lowercased:
Getting Startedbecomes#getting-started. - Spaces become hyphens; punctuation such as
.,?,(and:is dropped. Hyphens and underscores stay. - Letters with accents and other scripts are kept:
Kurulum ve ayarlarbecomes#kurulum-ve-ayarlar,Öne çıkanlarbecomes#öne-çıkanlar. - A repeated heading gets a number: the second
Usageis#usage-1.
Does a README still need a table of contents?
GitHub shows an outline button at the top of every rendered Markdown file, so readers on github.com can jump around without one. A written contents list still helps on npm, PyPI, GitLab mirrors and in editors, and it tells a reader at a glance how long the document is.
Regenerate it when you add sections. Check the result in the README preview, where the heading anchors work the same way.
Related tools
Questions people ask
How do I make a table of contents in Markdown?
Write a list of links to each heading’s anchor, such as - [Install](#install). This tool does it for every heading in the levels you choose.
Why does my link to a heading not work?
The anchor must match GitHub’s rule exactly: lowercase, spaces as hyphens, punctuation removed. Emoji and symbols are dropped too. Copy the anchor the tool produces.
Should the main title be in the contents?
Usually not. The default starts at level 2, ##, so the document’s # title is left out.
Does it work for GitLab or other sites?
GitLab and most generators use a very similar rule, so the links usually work. Headings with unusual punctuation may differ; check them once.