Markdown TOC Generator
Generate table of contents links from markdown headings
Input Markdown
Generated TOC
Markdown TOC Examples
Generate anchor links from headings. Example:
Project handbook headings
Input Markdown:
Generated TOC:
Use Sample above to load more headings.
What Is a Markdown TOC Generator?
A table of contents (TOC) helps readers navigate long documents. In Markdown, headings use # through ######. A TOC generator scans your headings and produces a list of links that jump to each section. GitHub Flavored Markdown and many static site generators support anchor links generated from heading text.
This tool runs in your browser. Paste Markdown or upload a file; the TOC updates as you edit. You can set minimum and maximum heading levels (e.g., H2–H4 only). Anchor slugs are created from heading text and deduplicated when headings repeat. For formatting Markdown, use Markdown Formatter. For converting to HTML, use Markdown to HTML.
How to Use This Tool
Paste or Upload Markdown
Paste your Markdown into the left editor or click Upload to load a .md, .markdown, or .txt file. Use Sample to load example headings. The TOC updates automatically.
Set Heading Level Range
Use Min H1–H4 and Max H3–H6 to include only certain heading levels. For example, Min H2 and Max H4 skips H1 and H5–H6. This keeps long docs focused.
Copy or Download the TOC
Copy the generated TOC to your clipboard or download it. Paste it at the top of your README or doc. For linting Markdown, use Markdown Linter. For syntax help, use Markdown Syntax.
Where TOC Generation Helps
README files on GitHub, documentation sites, and wikis benefit from a TOC. Readers can jump to sections without scrolling. The CommonMark spec defines heading syntax; GFM and most renderers support #anchor-slug links. Static generators like Eleventy and VitePress often auto-generate anchors.
For creating tables from CSV or delimited data, use Markdown Table Generator. For a quick syntax reference, use Markdown Cheat Sheet. For converting Markdown to HTML, use Markdown to HTML.
Frequently Asked Questions
How are anchor slugs created?
Headings are lowercased, special characters removed, spaces replaced with hyphens. Duplicate headings get a numeric suffix (e.g., #intro-1, #intro-2).
Does it work with GitHub?
Yes. GitHub generates anchors from headings. Paste the TOC at the top of your README; links will work in the rendered view.
Are headings in code blocks included?
No. Headings inside fenced code blocks (```) are ignored so code examples are not mistaken for document structure.
Can I limit depth?
Yes. Use Min/Max level dropdowns. For example, Min H2 and Max H4 produces a TOC with only H2, H3, and H4 headings.
Is my data sent to a server?
No. TOC generation runs entirely in your browser. No data is uploaded or stored.
Related Tools
Learn more: CommonMark, CommonMark spec, GitHub Flavored Markdown, Markdown Guide.