Hero Background

Next-Gen App & Browser Testing Cloud

Trusted by 2 Mn+ QAs & Devs to accelerate their release cycles

Next-Gen App & Browser Testing Cloud

Free Markdown TOC Generator Online

Build a Markdown table of contents from document headings. Choose GitHub-safe anchors, heading levels, and a nested list you can paste into a README. Processing stays in your browser.

Categories

...

Verify Before You Deploy

Terminal-native web and mobile automation.

Try Kane CLI
...

Write Tests in Plain English with KaneAI

Create, debug, and evolve tests using natural language.

Try for free
...

3000+ Browsers. One Platform.

See exactly how your site performs everywhere.

Try it free

Input

Use ATX headings such as ## Section. Headings inside fenced code blocks are ignored.

Minimum level

Maximum level

Slug style

Bullet

Indent

Output

Insert mode replaces [TOC] or <!-- toc -->, or places the list after the first H1.

ConvertGenerate TOC

Output

What is a Markdown TOC generator?

A Markdown TOC generator is a browser tool that reads ATX and setext headings in a Markdown document and writes a nested list of section links. Paste the source, set heading levels and a slug style, then copy the list or insert it at a [TOC] marker.

The parser follows CommonMark ATX heading rules: one to six # marks, then a space, then the heading text. TestMu AI maintains this tool so documentation and test plans stay easy to navigate. Pair the outline with a Markdown table generator when the same README also needs comparison tables.

Why does a Markdown table of contents matter?

A table of contents saves readers from scrolling a long README or test plan. An in-document list also travels with the file in Git, unlike a viewer-only outline. These are the main reasons teams add one:

  • Jump links in the file: Readers open a cloned README or printed export and still reach each section.
  • Stable review comments: Reviewers cite a heading fragment instead of a line number that drifts.
  • Faster onboarding: New teammates scan the outline before they read install or API notes.
  • QA plan navigation: Long Markdown test plans stay usable when cases sit many headings down.
Kane CLI - Testing Agent in Your Terminal

How do you generate a Markdown table of contents?

The generator runs in your browser. Follow these steps to build a linked table of contents from your Markdown headings.

  • Paste Markdown: Enter headings in the Input field, or load a .md or .txt file, a URL, or the sample.
  • Set options: Choose heading levels, slug style, bullet type, indent, and whether to skip the first H1.
  • Generate the TOC: Click Generate TOC. The list appears in Output, and the page scrolls to that result.
  • Copy or insert: Copy the TOC, download it, preview it with the eye icon, or choose Insert into document to place it at a [TOC] marker.

What is the difference between GitHub and GitLab heading anchors?

GitHub and GitLab both turn headings into fragment identifiers, but they do not treat punctuation and spaces the same way. Pick the matching slug style so pasted links land on the heading. GitHub basic writing syntax documents the GitHub rules used here.

RuleGitHubGitLab
CaseLowercase lettersLowercase letters
SpacesEach space becomes a hyphen, including runs left after punctuation is removedSpaces become hyphens, then consecutive hyphens collapse to one
PunctuationRemoved, so Setup & Config becomes setup--configRemoved, then hyphens collapse, so Setup & Config becomes setup-config
DuplicatesSecond match gets -1, then -2Second match gets -1, then -2
Inline markupBold, italic, code, and links are stripped before the slug is builtBold, italic, code, and links are stripped before the slug is built

What features does this Markdown TOC generator include?

This Markdown TOC generator covers the heading and slug options that README and docs workflows need. Here are the features of the tool:

  • ATX and setext headings: Hash headings and underline headings both become TOC entries.
  • Heading level range: Limit the list to H2 through H3, or any H1 through H6 window.
  • GitHub, GitLab, and CommonMark slugs: Match the renderer that will host the file.
  • Bullet and indent controls: Use -, *, +, or numbered markers with 2-space, 4-space, or tab indent.
  • Insert into document: Replace [TOC] or a comment marker, or place the list after the first H1.
  • Preview toggle: Open the eye beside Output to render the TOC as a linked list. The icon shows a strike while preview is on.
  • Browser-only processing: All processing happens in your browser. No document is uploaded except a URL you choose to load.

What are common use cases for a Markdown TOC generator?

Teams use a Markdown TOC when a document is long enough that readers need jump links. These are common cases:

  • Repository READMEs: Add a linked outline under the title, then finish the file in the README generator.
  • API and product guides: Keep a long Markdown guide scannable before you convert it with the Markdown to HTML converter.
  • Imported web copy: After an HTML to Markdown conversion, rebuild the outline from the new headings.
  • Data-heavy docs: Combine the TOC with CSV to Markdown tables in the same handbook.
  • Formatting cleanup: Run the Markdown formatter first if heading spacing is uneven.
  • QA test plans: Store cases in Test Manager and keep the Markdown plan outline in sync.

Frequently Asked Questions (FAQs)

How do I add a table of contents to a Markdown file?

A Markdown table of contents is a nested list of links to headings in the same file. Paste the document into this generator, click Generate TOC, and copy the list under the title. Each item uses the [text](#slug) form so readers can jump to that section.

Do Markdown TOC links work on GitHub?

Yes. GitHub builds a heading anchor from each heading so a list item such as [Install](#install) jumps to that section. GitHub also adds a separate outline menu when a file has two or more headings. An in-document TOC still helps in long READMEs that readers clone or print.

Should the first H1 appear in the table of contents?

Usually no. The first H1 is the document title, so repeating it in the TOC adds a link that only jumps to the top. This tool skips that first H1 by default. Turn the option off if your file uses H1 for real sections instead of a title.

How do GitHub heading anchors handle duplicate headings?

GitHub lowercases the heading, strips punctuation, and turns spaces into hyphens. A second heading with the same text gets a -1 suffix, then -2, as documented in GitHub basic writing syntax. This generator applies the same suffix rule so both TOC entries land on the right section.

What is the [TOC] marker in Markdown?

[TOC] is a placeholder some editors replace with a generated table of contents. This tool also honors an HTML comment marker. Choose Insert into document, then Generate TOC, and the list replaces that marker. If no marker is present, the list is placed after the first H1.

Can I limit which heading levels appear in the TOC?

Yes. Set the minimum and maximum heading levels before you generate. A common README range is H2 through H3, which keeps the list short. Headings inside fenced code blocks are ignored, so sample markup in a fence does not create extra entries.

Does this Markdown TOC generator upload my document?

No. Heading parsing and slug creation run in your browser. The file is not sent to a server, except when you choose Load from URL, which fetches that URL from your browser. Clear the input when you finish if the document is private.

Why do some TOC links fail after I rename a heading?

The slug is derived from the heading text. Rename a heading and the old fragment no longer matches, so the link goes nowhere. Generate the TOC again after heading edits. Duplicate headings also change suffixes when you reorder them, so regenerate after you move sections.

KaneAI - GenAI-Native Testing Agent

Did you find this page helpful?

TestMu AI forEnterprise

Get access to solutions built on Enterprise
grade security, privacy, & compliance

  • Advanced access controls
  • Advanced data retention rules
  • Advanced Local Testing
  • Premium Support options
  • Early access to beta features
  • Private Slack Channel
  • Unlimited Manual Accessibility DevTools Tests