Markdown TOC Generator

Markdown TOC Generator

Generate a table of contents from Markdown headings. Supports configurable depth, ordered/unordered lists, and GitHub-compatible anchor links for README navigation.

markdown
toc
table of contents
Share this tool:
Quick Presets
Common document structures for TOC generation
Input & Settings
Paste markdown to generate a table of contents
How it works: Scans your markdown for headings (# through ######), skipping code blocks, and generates a nested table of contents with optional anchor links and configurable depth.

Complete Guide: Markdown TOC Generator

Everything you need to know about using this tool effectively

What is Markdown TOC Generator?

The Markdown TOC Generator scans your document for headings and creates a nested table of contents with anchor links. It supports configurable heading depth, ordered or unordered list styles, and generates GitHub-compatible slug anchors. The output is a Markdown list you can paste at the top of your document. All processing happens in the browser.

This tool parses all headings in the Markdown input, determines their nesting level, and generates a Markdown list with relative anchor links. Each list item links to the corresponding heading using a URL-friendly slug derived from the heading text.

Key Features
Scans all heading levels (h1-h6)
Generates nested list structure
Creates GitHub-compatible anchor slugs
Configurable heading depth
Ordered or unordered list option
Copy TOC to clipboard
Real-time generation
Runs in the browser with no uploads
Common Use Cases
When and why you might need this tool

Adding navigation to READMEs

Generate a clickable table of contents for long GitHub README files.

Structuring documentation

Create a TOC for wiki pages and documentation sites.

Organizing blog posts

Add a table of contents to Markdown-based blog articles.

Preparing changelogs

Generate anchor links for changelog sections by version.

How to Use This Tool
Step-by-step guide to get the best results
1

Paste Markdown with headings

Enter Markdown text containing headings in the input area.

2

Configure options

Set heading depth and list style preferences.

3

Generate

Click Generate. The tool creates the TOC.

4

Copy the TOC

Copy the table of contents and paste it into your document.

Pro Tips
1

Start headings at h2 (##) for most READMEs. Reserve h1 for the title.

2

Use consistent heading text. Duplicate headings create ambiguous anchors.

3

GitHub auto-generates anchors from heading text with lowercase and hyphens.

4

Update the TOC after editing headings to keep anchors in sync.

Frequently Asked Questions
What anchor format is used?

The tool generates GitHub-compatible slug anchors: lowercase text with spaces replaced by hyphens and special characters removed.

Is my content sent to a server?

No. All generation happens in your browser. Nothing is transmitted.

Can I limit the heading depth?

Yes. Configure the maximum heading level to include (for example, h2-h3 only).

Does it work with GitLab?

Yes. GitLab uses similar anchor slug conventions to GitHub.

Can I use ordered lists?

Yes. Choose between ordered (1. 2. 3.) and unordered (- - -) list styles.