Skip to main content

Markdown Table of Contents Generator

Paste Markdown, choose the heading depth, and copy a nested table of contents with GitHub-style anchor slugs.

8 headings found
- [Getting Started](#getting-started)
  - [Installation](#installation)
    - [Requirements](#requirements)
    - [Downloading](#downloading)
  - [Configuration](#configuration)
- [Advanced Usage](#advanced-usage)
  - [Performance Tuning](#performance-tuning)
  - [Troubleshooting](#troubleshooting)

Slugs follow GitHub’s algorithm, so anchor links work inside READMEs, GitHub issues, and most static site generators. Headings inside fenced code blocks are ignored.

Generate linked navigation from Markdown headings

The Markdown TOC Generator scans ATX headings written with # characters and produces a nested list of anchor links for a README, guide, or documentation page.

You control which heading levels appear. The default includes H1 through H3; narrower ranges can produce a more focused outline. Fenced and indented code blocks are skipped so example headings do not enter the TOC.

As with every mdkit tool, everything runs in your browser. Paste proprietary docs without worrying about upload — your content stays on your device.

Markdown TOC example

Heading depth becomes list indentation, and heading text becomes an anchor slug.

Input
# Guide

## Install

### Requirements
Output
- [Guide](#guide)
  - [Install](#install)
    - [Requirements](#requirements)

How to use the Markdown Table of Contents Generator

  1. 1

    Paste your Markdown

    Paste the full Markdown document — or just the heading structure — into the input field.

  2. 2

    Set the heading depth

    Choose the minimum and maximum heading levels to include. The default is H1–H3.

  3. 3

    Copy the TOC

    The generated Markdown TOC appears on the right. Click copy and paste it at the top of your document, usually right after the title and summary.

Limits to know before you publish

  • The current parser recognizes # ATX headings, not Setext headings written with === or --- underlines.
  • Anchor-slug rules differ among GitHub, GitLab, static-site generators, and custom renderers; verify links on the destination platform.
  • The generated block must be replaced manually when document headings change.

Common use cases

  • Adding a navigation outline to the top of a long README
  • Generating an anchor-linked outline for docs site pages before committing
  • Building a TOC for a technical blog post that readers will skim
  • Producing a summary of a research document's structure for a collaborator
  • Quickly auditing the heading hierarchy of a doc — spotting skipped or duplicated headings

Frequently Asked Questions

Does this use GitHub-compatible anchor slugs?+
It follows common GitHub-style rules: lowercase text, strip most punctuation, replace spaces with hyphens, and suffix duplicate headings. Because platforms differ, verify generated links in your destination renderer.
Can I include all heading levels (H1–H6)?+
Yes. Set the maximum depth to 6. For most documents H2–H3 is enough; going deeper tends to produce a TOC that's noisier than the content itself.
Will it pick up headings inside code blocks?+
No. The generator skips any content inside fenced code blocks (```…```) or indented code blocks, so pseudo-headings in code examples won't pollute your TOC.
Does it handle duplicate heading text?+
Yes. If two headings have the same text, the second gets a -1 suffix in its anchor (like GitHub does), the third gets -2, and so on, so every link stays unique.
Can I regenerate the TOC when I update the document?+
Paste the updated Markdown, grab the new TOC, and replace the old block. Consider marking the TOC block with HTML comments (<!-- toc --> … <!-- /toc -->) so it's easy to find later.

Related tools

Learn more