Dev TooloraLocal dev tools

> Text

Markdown TOC

Build a linked table of contents with GitHub anchors from Markdown headings.

Runs locallyWorks offline
Back to results
Input

Source data

List style
Output

Result

Your result will appear here.

Tool guide

About this tool.

  • The Markdown TOC tool reads the headings of a Markdown document and writes a nested list of links to them. It runs locally in your browser or editor, so your document never leaves your machine.
  • Both heading styles are understood: lines starting with hash marks, and text underlined with equals signs or dashes. Headings inside fenced code blocks and indented code are ignored.

  • Anchors follow the GitHub rules: lowercase, punctuation removed, spaces turned into hyphens. Repeated headings get a numeric suffix such as intro-1, in document order.
  • Links, images, emphasis and HTML tags inside a heading are reduced to their text before the anchor is made, so a linked heading still gets a clean anchor. YAML front matter at the top of the file is skipped.

Paste a Markdown document and pick the heading levels to include.

Choose a dash, asterisk or numbered list style.

The result is a nested list of links using GitHub style anchors.

Code blocks are skipped, and duplicate headings get numbered anchors.

The summary shows how many headings were listed.

  • ## Intro, ### Setup → - [Intro](#intro) with a nested - [Setup](#setup)
  • Two headings called Intro → #intro and #intro-1
  • ## Closing ## → - [Closing](#closing)
  • Numbered style → 1. [A](#a) with nested 1. [B](#b)

  • Input is limited to 1,000,000 characters.
  • The minimum level must not exceed the maximum level.
  • Headings with no text are skipped.

FAQ

Questions about Markdown TOC

Which headings are included?

The shallowest and deepest heading levels decide which headings are listed. The default is levels 2 and 3, which leaves out the page title. Change them to match your document.

How are duplicate headings handled?

Headings are counted in document order, including headings outside the chosen range, as GitHub does. The first keeps the plain anchor and later ones get -1, -2 and so on.

How is the list nested?

Nesting is based on the heading level minus the shallowest level listed. Bullet lists indent by two spaces and numbered lists by three, so the result renders correctly.

Will the links work everywhere?

GitHub and most renderers use the same anchor rules, but some tools differ, for example with non-Latin letters. Check the links once in your target renderer.

Continue with

Markdown HelperClean raw HTML and surplus blank lines without rewriting code, and inspect parsed Markdown statistics.Markdown to HTMLConvert Markdown into real HTML with a local visual preview, explicit syntax options and exact file export.SlugifyCreate predictable ASCII or Unicode slugs with safe separators and explicit accent handling.