Markdown Table of Contents

Paste your Markdown and get a nested list of links to its headings, ready to paste at the top of the document.

How it works

The document is read by marked, the same parser the Markdown preview uses, so a # inside a code block is not mistaken for a heading and an underlined heading is found.

Each heading becomes a link to its anchor, made the way GitHub makes them: lower case, punctuation dropped, spaces turned into hyphens, and -1, -2 added when a heading text repeats.

You choose how deep the list goes, not which heading levels. If the document has one # title, the title is left out and the list starts at its sections. The work runs in a background worker, so nothing leaves your browser.

How to use it

  1. 1 Paste your Markdown document.
  2. 2 Choose how deep the contents go: sections only, sections with subsections, or every heading.
  3. 3 Choose bullets or numbers.
  4. 4 Copy the table of contents and paste it near the top of your document.

Good to know

  • Paste the list after the title and the opening paragraph, where readers expect it.
  • If you rename a heading later, its anchor changes too. Generate the list again so no link points at the old name.
  • Two headings with the same text get different anchors, such as #setup and #setup-1, in the order they appear.
  • Numbered contents read well for a manual or a long guide; bullets suit a README.

Browser support

  • Chrome 94 and later
  • Firefox 93 and later
  • Safari 16.4 and later
  • Edge 94 and later

These are the oldest versions with everything the tool uses. They are worked out from the tool itself, so they change when it does.

Version numbers checked on 2026-09-04.

Adding contents to a README that has grown

READMEs start short and then grow. Once a file has an install section, a usage section, configuration, troubleshooting and a changelog, readers stop scrolling and start searching. A table of contents at the top lets them jump straight to the part they need, and on GitHub each entry is a working link.

Here is a typical outline: "# Tidy", then "## Install", "### With npm", "### With Homebrew", "## Usage", "## Configuration" and "## FAQ". The single # line is the project name, so it is left out. With With subsections chosen and bullets, the result is "- [Install](#install)", then two indented entries "- [With npm](#with-npm)" and "- [With Homebrew](#with-homebrew)", then "- [Usage](#usage)", "- [Configuration](#configuration)" and "- [FAQ](#faq)". Choose Sections and the two indented lines disappear.

The anchors are where hand-written contents usually go wrong. "## What's new?" becomes #whats-new, because the apostrophe and question mark are dropped. "## API v2.0" becomes #api-v20, with the full stop gone. A heading with an emoji in it loses the emoji. If two sections are both called "## Example", the second one's anchor is #example-1. Working these out by hand is tedious; here they are made by the same rule GitHub applies.

Paste the list just under the title and the one-line description, and leave a blank line before and after it. Some people put a "## Contents" heading above it. If you do, that heading will appear in the list the next time you generate it; delete that line, or leave it, since a link to the contents is harmless.

There are limits. The list is a snapshot: rename a heading and the matching link breaks until you generate the list again. Sites that make anchors their own way, such as some documentation generators and wikis, may not match GitHub's rule, so test one link there. Headings written in raw HTML, such as <h2>Notes</h2>, are not listed. And documents over one million characters are refused.

Frequently asked questions

Will the links work on GitHub?

Yes, for ordinary headings. The anchors follow GitHub's rule: lower case, punctuation removed except hyphens and underscores, each space replaced by a hyphen, and a number added to repeats. GitLab and most static site generators use the same rule. A site with its own anchor scheme may differ.

Why is my main title missing from the list?

A document with exactly one # heading is treated as having a title, and a table of contents usually lists what is under the title, not the title itself. If your document has several # headings, they are listed as the top level.

Are headings inside code blocks included?

No. A line starting with # inside a fenced or indented code block is code, not a heading, and the parser knows the difference. Headings inside quotes and list items are included, because renderers give them anchors too.

Is my document uploaded?

No. It is read in your browser, in a background worker with a 3-second limit, and the list is made on this page.

Related tools

Your files are processed on your device and are not uploaded. You can verify this in your browser’s developer tools under the Network tab.