Markdown Table of Contents Generator
Analyze Markdown headings (#, ##, ###) to auto-generate a linked table of contents.
Category: Text Tools
When to use?
Use it when writing a README or technical doc and a manual table of contents is tedious. Generate a linked TOC that keeps the heading hierarchy in one go.
How to use
- Paste the whole Markdown document.
- It analyzes # / ## / ### headings to build an indented TOC.
- Copy the TOC and paste it at the top of your document.
Input Explanation
Paste the whole document with Markdown heading syntax (#, ##, ###), or just the headings.
Calculation Basis
It detects lines starting with # and uses the number of # for the heading level, converts heading text to GitHub anchor rules (lowercase, spaces→hyphens) to make [title](#anchor) links, and indents by level.
Usage Examples
- Generate a README TOC - Analyze your README's heading structure to auto-build a top TOC.
- Document navigation - Add a section-link TOC to a long doc so readers find sections fast.
- Check document structure - Use the generated TOC to see whether the heading hierarchy is correct.
Examples
- ## Intro / ### Installation → - [Intro](#intro)\n - [Installation](#installation)
- A long doc with 20 headings → generate an indented TOC at once
Cautions
- Counts can vary by how spaces and line breaks are handled.
- A leading-# pattern is treated as a heading, so # inside code blocks may need manual exclusion.
Guides
Why a table of contents helps SEO
Search engines favor pages whose sections are organized with hash links. A hierarchy-aware TOC at the top of a document signals structure and can help ranking.
Fixing broken anchors in GitHub READMEs
GitHub converts headings to lowercase, dash-separated anchor IDs. Generating links with the same rule prevents the typos that creep in when TOC links are written by hand.
FAQ
Does it follow GitHub anchor rules?
Yes, it generates anchors GitHub-style with lowercasing and spaces replaced by hyphens.
Can there be duplicate headings?
Duplicate headings get -1, -2 suffixes like GitHub.
Which heading levels are included?
It analyzes # through ### into an indented TOC.
Are # inside code blocks treated as headings?
A leading-# pattern is treated as a heading, so you may need to exclude # inside code blocks manually.
Related Tools
- Markdown Anchor Link Generator - Convert heading text into a GitHub-style anchor link.
- Markdown Preview - Render Markdown in real time and provide an HTML preview.
- Markdown Table Generator - Set columns and rows and enter content to generate Markdown table syntax instantly.
- Markdown → HTML Converter - Convert a Markdown document to HTML with a rendered preview.
- Character Counter - Count characters with and without spaces, and line count, in real time.
- Byte Counter - Calculate the byte length of text when stored as UTF-8.