Markdown TOC Generator
Generate a table of contents from markdown headings — supports depth filtering, ordered lists, and inline insertion
About this ToolHow it works, benefits & use casesTap to collapse
Paste a Markdown document and this tool reads its headings to build a linked table of contents. It recognizes both ATX headings (# through ######) and Setext headings (text underlined with === or ---), then turns each into a bullet that links to a GitHub-style anchor — lowercased, with punctuation stripped and spaces hyphenated. Nesting is preserved: deeper headings are indented relative to the shallowest level found. You control the range with Minimum and Maximum depth selectors (H1–H6), can switch between a bulleted or numbered (1.) list, and can skip the first heading so a document title is not duplicated in its own TOC. Duplicate headings get unique anchors (-2, -3, …) so links never collide. You get two outputs: the standalone TOC on its own, and the complete document with a "## Table of Contents" section inserted either at the very top or right after the title.
How to Use
- 1Paste your Markdown into the input panel, or click Load example to try the demo document.
- 2Set Minimum depth and Maximum depth to choose which heading levels (H1–H6) appear.
- 3Toggle "Use ordered list" for a numbered TOC, and "Skip first header" to omit the document title.
- 4Pick an Insert position — After title or At the top — for the embedded TOC.
- 5Click Generate TOC to produce the standalone list and the full document with the TOC inserted.
- 6Copy or download either output, or pipe the standalone TOC into another tool.
Key Benefits
- Detects both ATX (#) and Setext (underline) headings
- GitHub-compatible anchor slugs generated from each heading
- Depth filtering with independent minimum and maximum (H1–H6)
- Ordered (1.) or unordered (-) list output, your choice
- Skip-first-header option avoids duplicating the document title
- Duplicate headings get unique, collision-free anchors automatically
- Outputs both a standalone TOC and the full document with the TOC inserted
Common Use Cases
- Adding a navigable table of contents to a long README before pushing to GitHub
- Generating section links for documentation pages and wiki articles
- Trimming a TOC to only H2/H3 by setting the depth range
- Producing a numbered outline of a spec or design doc
- Refreshing the TOC after restructuring a document’s headings
TOC options
Run to see the generated table of contents.
Was this tool helpful?
Share Your Experience
Help others discover this tool!
Related tools
- Changelog GeneratorGenerate changelog from Git commit history
- HTML to MarkdownConvert HTML to Markdown
- Markdown Link CheckerCheck for broken links in Markdown files
- Markdown to HTMLConvert Markdown to HTML
- JSDoc to MarkdownTurn JSDoc comments into Markdown API docs — params table, returns, throws, examples, badges, optional TOC — for functions, classes & typedefs
- Component Name GeneratorTurn a description into ranked, kind-aware component names with a file scaffold and a name validator (casing, collisions, clarity)
Each heading is slugified the GitHub way: lowercased, special characters removed, and spaces collapsed into single hyphens. The TOC links to #that-slug. If two headings produce the same slug, the second and later ones get a numeric suffix (-2, -3) so every link points to a distinct anchor.
Yes. Alongside ATX headings (# to ######), it recognizes Setext headings — a line of text underlined with === (level 1) or --- (level 2) — and includes them in the table of contents at the correct level.

