deftools.io Text & Data

📑 Markdown TOC Generator

Generate a table of contents from Markdown headings

0 headings
to

About this tool

A Table of Contents is a nested list of links to the headings in a Markdown document. GitHub, GitLab, npm, and most static-site generators render heading-anchor links automatically, so a hand-written TOC at the top of a README or wiki page lets readers jump straight to the section they need.

Paste your Markdown into the input — every # Heading line becomes a TOC entry. Adjust the depth range to include only H2–H4, for example. The generated links use the same slug algorithm as GitHub, so they work on nearly every platform.

Use Insert to place the TOC directly into your document at the cursor position, or copy it for use elsewhere.

FAQ

Why do some links have -1 or -2 appended?

When two headings have the same text ("Installation" in two different sections), GitHub appends a counter to keep the anchors unique. This tool does the same.

Does the anchor format work on GitLab / Bitbucket / my static site?

The slug algorithm (lowercase, spaces→hyphens, strip punctuation) is the de facto standard. GitHub, GitLab, Bitbucket, mdBook, and Hugo all use it or a close variant. If your platform differs, tweak the output manually.

Why are some headings missing from the TOC?

Check the Depth selectors — only headings between the Min and Max levels appear. Also, headings inside fenced code blocks (<code>```</code>) are ignored.

Related text & data tools

Copied!