Markdown TOC Generator
Generate a Markdown table of contents β GitHub / GitLab / plain slugs, configurable depth, auto-dedup.
Tool code processes selected files and entered content in your browser and does not submit them to a TOOLGRID processing endpoint. TOOLGRID measures tool usage, not the content you enter.
Loading toolβ¦
Browser-basedWhat this tool does
In-browser Markdown TOC generator. Extracts headings, generates nested anchor-linked TOC, supports GitHub-compatible slug style.
GitHub-style anchors follow GitHub's documented basic rules for plain heading text: lowercase letters, spaces changed to hyphens, punctuation removed, Unicode preserved, and duplicate anchors suffixed. ASCII-only anchors deliberately remove non-ASCII characters and collapse repeated separators for older or restricted destinations.
Other settings: cap depth at H2/H3/H4/H5/H6 (deeper headings are skipped), and optionally exclude the document's H1 title (most READMEs use H1 as the document title and don't want it in the TOC).
What you can do with this tool
READMEs over a few screens benefit from a top-of-file TOC. Paste your full README in, copy the output, and paste it after the intro. Use GitHub-style anchors for plain headings rendered on GitHub.
Many static-site generators (Docusaurus, Nextra, MkDocs) consume Markdown with anchor links. Use this tool to pre-generate the TOC instead of relying on the framework's auto-TOC plugin if you want manual control.
Long internal design docs benefit from a navigable TOC. The depth cap means you can show top-level sections only (H2) or include sub-sections for fine-grained navigation.
What to check before relying on the result
- Performance and maximum practical input size depend on browser memory, device speed, and the structure of the input.
- Review the generated result before replacing or publishing an original file.
How to use
- 1
Pick max heading depth (default H3), anchor style (default GitHub-style), and whether to skip H1.
- 2
Paste your Markdown document into the input area.
- 3
Copy the generated TOC and paste it at the top of your document (typically right after the title and intro).
Use Cases
READMEs over a few screens benefit from a top-of-file TOC. Paste your full README in, copy the output, and paste it after the intro. Use GitHub-style anchors for plain headings rendered on GitHub.
Many static-site generators (Docusaurus, Nextra, MkDocs) consume Markdown with anchor links. Use this tool to pre-generate the TOC instead of relying on the framework's auto-TOC plugin if you want manual control.
Long internal design docs benefit from a navigable TOC. The depth cap means you can show top-level sections only (H2) or include sub-sections for fine-grained navigation.
If a destination cannot use Unicode fragments, switch to ASCII-only anchors and review any heading that loses distinguishing characters or falls back to <code>#section</code> before publishing.
Generating the TOC is a fast way to see if your headings flow logically. A TOC with too-deep nesting, repeated section names, or missing H2-level sections usually signals an organization problem worth fixing.
Tips & Tricks
If two headings resolve to the same anchor, the later one gets an incrementing suffix such as <code>-1</code>. Anchors are assigned before depth and H1 filters, so omitted headings still reserve their destination fragment.
Lines that look like headings inside <code>```</code>-fenced code blocks (e.g., a shell prompt that includes a hash) are correctly excluded from the TOC.
If your document starts at H2 (no H1, or H1 skipped), H2 sits flush-left in the output. The TOC tree's root is whichever level is shallowest in your filtered headings.
GitHub-style anchors keep Unicode letters, so a Chinese or Korean heading can retain its script. ASCII-only removes those characters for restricted destinations; review any empty or ambiguous result.
FAQ
Does the tool run entirely in my browser?
Parsing and slug generation use browser-side JavaScript. Tool code processes selected files and entered content in your browser and does not submit them to a TOOLGRID processing endpoint. Browser-local processing avoids a TOOLGRID upload path, but it is not a blanket security guarantee.
What anchor styles are supported?
Two: GitHub-style (default β lowercase, Unicode-preserving, spaces to hyphens, most punctuation removed) and ASCII-only (non-ASCII characters removed and repeated separators collapsed). Check complex inline formatting against the final renderer before publishing.
Why is my generated TOC link broken on GitHub?
Hover the rendered heading and compare GitHub's copied fragment with the generated link. Complex inline Markdown can be normalized by the renderer before slugging, and renderer-specific rules can differ from this tool's documented plain-heading behavior. Duplicate suffixes also count headings omitted from the TOC.
Does it support setext headings (<code>===</code> / <code>---</code>)?
Not currently β only ATX-style <code>#</code>-prefixed headings are recognized. If your document uses setext (underline) syntax, convert to ATX first or paste-and-pre-process.
How does the tool handle headings with inline Markdown (links, code, emphasis)?
The TOC label preserves the heading source, while anchor normalization removes punctuation. The tool does not run a full inline-Markdown renderer before slugging, so headings with links, code spans, HTML, or nested formatting must be checked against the destination's rendered anchor.
Can I generate TOCs for HTML, AsciiDoc, or reStructuredText?
This tool targets Markdown only. For other formats, look for format-specific TOC generators (Pandoc has TOC generation for many input formats; AsciiDoc has built-in <code>:toc:</code> directive).
Why is the H1 skipped by default?
Most documents use H1 as the document title ("README", "My Project"). Including the title in its own TOC creates a noisy first entry that points back to the top of the page. Toggle it off if your structure uses H1 for sections instead of one document title.
Useful next steps
Open a nearby browser tool when you need to validate, convert, or reuse the result.