Markdown

or drop a file here, or paste code below
Table of contents

No input yet.

Table of contents

Files never leave your browserHow?

Table of contents with GitHub anchors

This generator builds a table of contents for a Markdown file from its headings, with anchor links that match GitHub and GitLab. Paste a README and copy the TOC, or download the document with the TOC inserted between markers.

Last updated:

How it works

  1. Paste the Markdown

    Paste a README, open an .md file or load it from a URL. Headings inside code blocks and HTML comments are ignored.

  2. Pick levels and style

    Choose which heading levels to list, bullets or numbers, the indent, and GitHub or GitLab anchors.

  3. Copy or insert

    Copy just the list, or take the whole document: the TOC is placed between <!-- toc --> markers, and an existing TOC block is replaced.

Features

  • Anchors exactly like GitHub

    The anchors follow github-slugger: lower case, punctuation removed, spaces to dashes, and repeated headings numbered -1, -2 across the whole page.

  • Re-run safely

    Markers from markdown-toc (<!-- toc -->), Markdown All in One (<!-- TOC -->) and doctoc are recognised, so updating a TOC never duplicates it.

  • Clean link text

    Bold, italics, inline code and links in headings are reduced to their visible text, the way the rendered heading reads.

  • Setext headings too

    Headings underlined with === or --- are found as well as # headings.

  • Check every anchor

    The Anchors tab lists each heading with its level and the generated #anchor, handy for linking from other pages.

Limits & privacy

Documents up to 5 MB; larger ones are processed in a background worker so typing stays smooth. The table of contents is generated in your browser and the file is never uploaded. See the privacy page.

FAQ

How do I add a table of contents to a GitHub README?

Paste the README, keep GitHub anchors and the H2–H3 range, and download the document. The TOC sits under the title between <!-- toc --> markers.

Why do my anchor links not work?

Anchors depend on the platform. GitHub removes punctuation and keeps double dashes; GitLab collapses them. Pick the platform where the file is shown.

How are duplicate headings handled?

Like on GitHub, the second "Usage" heading gets the anchor #usage-1, the third #usage-2. Hidden or skipped headings still count.

Can I update an existing TOC?

Yes. If the document already has a TOC between known markers, only that block is replaced; the rest of the file stays byte for byte the same.

Can I make a numbered table of contents?

Choose 1. item as the list style. Each level is numbered separately and indented under the text of its parent item.

Should the document title be in the TOC?

Usually not. Skip the title leaves out the first H1, so the list starts with the sections.

Related tools