Table of Contents Generator

Turn a long article, documentation page, or README into a navigable table of contents. Paste HTML or Markdown, choose which heading levels to include, and generate a nested list of anchor links together with updated heading IDs when needed.

Live preview

Advertisement

Example: a camping checklist

Paste this Markdown into the generator:

# Camping checklist
## Shelter
## Cooking
### Stove and fuel
## Clothing

Shelter, Cooking and Clothing are sibling sections. Stove and fuel is nested under Cooking. The default heading range starts at H2; choose H1 as the minimum level to include the Camping checklist title.

Copy the HTML or Markdown TOC, and use Updated HTML for the destination content with matching heading IDs. Repeated headings receive distinct anchor IDs.

What this generator does

How to use

  1. Paste the document or relevant content.
  2. Choose input format or leave Auto Detect enabled.
  3. Select the heading range, usually H2–H4 for articles.
  4. Choose HTML or Markdown output.
  5. Review the preview and duplicate-heading suffixes.
  6. Copy the TOC and, for raw HTML, copy the updated heading markup if IDs were added.

Best practices

Advertisement
Advertisement

Frequently asked questions

Does the generator change my content?

Only when you choose the Updated HTML output. Existing valid IDs are preserved; missing IDs are added so generated links have targets.

How are duplicate headings handled?

The first heading receives the base slug and later duplicates receive numeric suffixes, such as setup and setup-2.

Can I generate Markdown?

Yes. The tool can create a nested Markdown list with anchor links as well as HTML.

Related tools & guides