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
What this generator does
- Parse H1–H6 HTML headings and ATX/Setext Markdown headings.
- Choose minimum and maximum heading levels.
- Create deterministic, collision-safe slugs for duplicate headings.
- Output nested HTML or Markdown.
- Optionally return updated HTML with missing heading IDs added.
How to use
- Paste the document or relevant content.
- Choose input format or leave Auto Detect enabled.
- Select the heading range, usually H2–H4 for articles.
- Choose HTML or Markdown output.
- Review the preview and duplicate-heading suffixes.
- Copy the TOC and, for raw HTML, copy the updated heading markup if IDs were added.
Best practices
- Keep one logical H1 for the page title.
- Do not include every deep heading if that makes the TOC harder to scan.
- Preserve existing valid IDs instead of rewriting them.
- Use native anchor links so the TOC still works without JavaScript.
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
Scrolling Text HTML & CSS Examples
Practical examples for left, right, vertical and scroll-box text using modern HTML and CSS.
Meta Tag Generator
Generate title, description, canonical, robots, Open Graph and social meta tags with a live search/social preview.
Schema Markup Generator
Generate JSON-LD for common structured-data types and validate required fields before copying. Use only markup that matches visible page content.
JSON Formatter & Validator
Format, minify and validate JSON locally in your browser with clear parse errors, tree view and copy/download controls.