Markdown

Table of Contents Generator

Generate a linked table of contents from a document's headings, with GitHub-compatible anchor links. Runs entirely in your browser; nothing you paste is ever sent anywhere.

Min
Max
Markdown
Paste Markdown on the left to generate a linked table of contents.

Quick Learn

Long Markdown documents — READMEs, integration guides, RFCs — get hard to navigate once they pass a handful of headings. A table of contents fixes that with a list of links that jump straight to each section, generated once and pasted in at the top of the file.

This tool reads every heading in your document (both # ATX style and the older underlined Setext style for H1/H2), skips anything inside fenced code blocks so a "# comment" in a shell snippet never gets mistaken for a heading, and builds anchor links the same way GitHub renders them — lowercased, punctuation stripped, spaces turned into hyphens, and duplicate headings automatically numbered (-1, -2, ...) so every link is unique. Everything runs locally in your browser.

Best Practices

  • •Use the Min/Max level filters to keep the TOC readable — H1–H3 is a common default; including H4–H6 in a long doc usually produces a wall of links instead of a useful overview.
  • •The generated anchors match GitHub's own heading-link algorithm, so this TOC works correctly when pasted into a README or wiki page rendered on GitHub.
  • •If you're not publishing to GitHub, double-check anchor links against your actual renderer — some Markdown processors (Jekyll, GitBook, custom site generators) slugify headings slightly differently.
  • •Duplicate heading text (two sections both called "Overview") is handled automatically — the second occurrence links to a "-1" suffixed anchor, matching how GitHub disambiguates them.

More Markdown Tools

See all Markdown tools

Frequently Asked Questions

Is my document uploaded anywhere?

No. The table of contents is generated entirely in your browser — nothing you paste, type, or drop as a file is sent to a server.

Which heading styles are supported?

Both ATX headings (# Heading) at any level 1–6, and Setext headings (underlined with === or ---) for H1 and H2. Headings inside fenced code blocks are correctly ignored.

How are the anchor links generated?

Using the same slug algorithm GitHub uses to link headings on rendered Markdown pages — so a TOC generated here works correctly when pasted into a GitHub README or wiki.

What happens with two headings that have the same text?

The second one gets a numbered suffix on its anchor (e.g. #overview-1), exactly matching how GitHub disambiguates duplicate headings — so both links stay unique and correct.

Can I drop a whole .md file instead of pasting?

Yes — drag a .md, .markdown, or .txt file onto the panel, or use the Choose File button, and its contents load directly into the editor.

Want the engineering deep-dives behind tools like this one?