Skip to content
100% local

Markdown TOC generator

Generate a linked table of contents from the headings of a Markdown document, with GitHub-style anchors.

Input
Output

Markdown TOC generator

Paste a Markdown document and get a linked table of contents back instantly. The tool scans the text for ATX headings — the # to ###### kind — and builds a nested Markdown list ready to paste at the top of a README, a wiki page or any documentation file. Heading-like lines inside fenced code blocks are ignored, so example Markdown in your snippets never leaks a phantom entry into the TOC.

Anchors follow GitHub's rules: the heading text is lowercased, spaces become hyphens and punctuation is stripped, while letters with diacritics are kept — GitHub keeps them too, so a heading like "Číslo účtu" links as #číslo-účtu and the TOC works on github.com, GitLab and most Markdown renderers out of the box. When several headings share the same text, the second and third get -1 and -2 suffixes, exactly as GitHub numbers them. Bold, italic, inline code and link markup inside a heading disappears from the label; its readable text stays.

The Levels select controls how deep the list goes: the default H2–H3 suits most READMEs, H1–H6 captures everything, and H2 only or H2–H4 fit flatter or deeper documents. Style switches between bullets and a numbered list, unticking Links produces a plain-text outline instead of anchor links, and Indent with tabs swaps the two-space nesting for tab characters, matching whichever style your repository uses.

Everything runs locally in your browser — the document is never uploaded, so private specs and unreleased drafts stay on your device. The tally under the output counts the headings found and the TOC lines produced, and the result can be copied or downloaded with one click. It reads HTML too: paste a page and the tool picks up its h1–h6 tags, reusing an id already on the tag as the anchor. "Flag structure problems" then marks any heading that skips a level, and every top-level heading past the first.

FAQ

Which headings does the tool recognize?
ATX headings — a line starting with 1–6 hash characters and a space, from # to ######. Headings inside ``` fenced code blocks are skipped. Setext headings (a line underlined with === or ---) are not recognized; write them as # headings instead.
Will the links work on GitHub?
Yes. Anchors are built with GitHub's rules — lowercase, spaces to hyphens, punctuation stripped, diacritics kept — and duplicate headings get the same -1, -2 suffixes GitHub appends, so the TOC works when pasted into a README.
Can I get a numbered list or plain text instead?
Yes. Set Style to Numbered for an ordered list with per-level counters, and untick Links for a plain outline without anchor links. Indent with tabs swaps the two-space nesting for tabs.
Is my document uploaded anywhere?
No. Table of contents generation and anchor extraction happen entirely locally — your document never leaves your device.
Can it build a TOC from HTML?
Yes. Paste HTML and the tool detects the h1–h6 tags on its own; set "Input format" explicitly if the page mixes both syntaxes. An id already on a tag becomes the anchor, so the links point at the anchors the page really has, and nested markup like code or a link inside a heading is unwrapped to its text.