Rankite
ServicesResultsToolsTeamAboutBlogCareersContactFree SEO Audit
Free tool

Table of Contents Generator

List your headings below, one per line, and get a clean, nested table of contents with working anchor links, free and instant.

Home / Tools / Free Table of Contents Generator
Table of contents (HTML)

 
 
Matching headings with IDs

 
 

Paste the heading tags into your CMS in place of your current H2s and H3s, then paste the TOC block wherever you want the list of links to appear.

Built by Rankite, the SEO team behind Swordfish AI's +400% revenue and Zluri's +45% organic growth. See the case studies

A table of contents helps readers jump straight to the section they want, and it gives Google jump links to show directly in the search result for long pages. This tool turns a plain list of headings into working anchor links and matching heading IDs.

How to format the input

Type or paste one heading per line. A plain line becomes a top-level entry, meant to match an H2 on your page. Start a line with a dash and a space to make it a sub-entry nested under the heading above it, meant to match an H3.

The tool automatically turns each heading into a URL-friendly ID, lowercased with hyphens instead of spaces, and adds a number to the end if two headings would otherwise produce the same ID.

Two outputs, two jobs

The first block is the table of contents itself, a nested list of links ready to drop near the top of your article. The second block is your original headings rewritten as actual heading tags with matching id attributes, which is what makes the links in the first block actually work.

Replace your existing H2 and H3 tags with the ones from the second block, or just copy the id attribute into each heading if you'd rather keep your own formatting.

Google sometimes shows jump links directly under a search result for long, well-structured pages, sending visitors straight to the relevant section instead of the top of the page. That only works if your headings have real, unique id attributes for Google to link to.

It also helps readers self-select: someone who only wants one part of a long guide can find it in two seconds instead of scrolling, which tends to reduce bounce rate on longer content.

Related articles

FAQ

Table of Contents Generator: questions, answered

Does this work with Markdown headings like ## instead of a dash?
Not directly, this version expects a plain line for a top-level heading and a line starting with a dash for a sub-heading. If your content already uses Markdown, strip the # symbols and use dashes for sub-levels instead.
Will the anchor links work immediately after I paste them in?
Yes, as long as you also add the matching id attributes from the second output block to your actual heading tags. The links only work if the ids on the page match the ids in the table of contents.
Can I have more than two heading levels?
This tool supports two levels, top-level and one sub-level, which covers the large majority of blog posts and guides. For deeper nesting you'll need to adjust the generated HTML by hand.
What happens if two headings have the same text?
The tool automatically appends a number to the id of any duplicate, so you always get unique, working anchor links even if two sections share a title.
Does adding a table of contents actually help SEO?
It can help indirectly. Google sometimes surfaces jump links to well-structured sections in search results, and a clear structure tends to improve time on page, both of which are associated with, though not guaranteed by, better performance.

More free tools

Let's grow

Ready to own page one?

Get a free, no-obligation SEO audit and a 30-minute strategy session. We'll show you exactly where the growth is hiding.

Book your free audit Explore services
Get in touch

Tell us about your project

Fill out the form and we'll get back to you within one business day. Prefer email? Write to us directly at contact@rankite.com.

Or copy our email and write to us directly: contact@rankite.com