100% in your browser · your files never leave your device

Markdown TOC Generator — Heading Outline & Anchor Links

Generate a table of contents from any markdown document: heading outline, GitHub-style anchor slugs, and nested copy-ready markdown or HTML lists.

Loading tool…

More tools

All free, all private — everything runs in your browser.

How to use TOC Generator

  1. 1Paste your document; the heading outline appears with levels and anchors.
  2. 2Set the maximum depth to include (e.g. h1–h3 for a compact TOC).
  3. 3Switch between markdown and HTML output — anchors are GitHub-compatible slugs.
  4. 4Copy the TOC into the top of your document.

TOC Generator FAQ

Do the anchor links match GitHub's slugs?
Yes — the slugger implements GitHub's algorithm: lowercase, strip punctuation, spaces to hyphens, with -2, -3… suffixes for repeated headings. Links pasted into a GitHub README jump to the right heading.
Can I limit the TOC depth?
Yes — include only headings up to a chosen level (e.g. h2–h3 for a compact README TOC). The outline view can show every level regardless.
Markdown list or HTML output?
Both. Copy a nested markdown list (works in any renderer that auto-links anchors) or a nested HTML <ul> with inline styles for pasting into email or a CMS.
What about documents with duplicate heading text?
The slugger deduplicates exactly like GitHub — the first occurrence gets the bare slug, later ones get numeric suffixes — so every TOC link is unique and correct.