Add a Table of Contents in WordPress Without a Plugin

Long posts can be hard to scan. A reader lands on your article, sees a wall of text, and leaves before finding the part that answers their question. A table of contents solves this problem in a simple way. It gives readers a short list of sections at the top of the post, and each item jumps straight to that section when clicked.
You do not need a plugin for this. WordPress already gives you everything you need: headings, HTML anchors, a List block, and a place to add a little CSS. The manual method takes a few extra minutes the first time, but it keeps your site lighter, avoids another plugin to update, and gives you full control over how the list looks. This guide walks through the whole process in plain language.
What Does a Table of Contents Do for Readers and SEO?
For readers, a table of contents works like the contents page of a book. It shows the structure of the post before they start reading. Someone who only needs one step can jump to it. Someone who wants the full guide can see how long it is and what it covers. This is especially helpful for tutorials, reviews, comparisons, and any post longer than about 800 words.
For search engines, clear headings and a linked contents list help Google understand the structure of your page. Well written H2 and H3 headings act as signposts for each topic in the post. That does not guarantee a ranking boost, and no honest guide should promise one, but good structure supports the same kind of clear, helpful content that search engines already reward. It also supports internal linking, because a table of contents is really a set of helpful links inside your own post. If you are still learning how links inside your site work, read our guide on WordPress internal linking strategy next.
A table of contents also helps you as the writer. When you list your sections at the top, gaps in your outline become obvious. If one section is missing, or two sections cover the same point, you can fix the structure before you publish.
How Does the Manual Method Work?
The manual method has three parts. First, you give each important heading a short HTML anchor, which is just a unique name for that spot on the page. Second, you build a list of links at the top of the post, with each link pointing to one anchor. Third, if you want a nicer feel, you add one small piece of CSS so the page scrolls smoothly instead of jumping sharply. That is the whole system. Nothing else is required.
Plan your anchors before you start linking. Use short, lowercase names with hyphens between words, such as what-is-a-toc or step-two-build-the-list. Avoid spaces, capital letters, and special characters in anchor names. Keep each anchor unique on the page. If two headings share the same anchor, the link will always land on the first one.
Step 1: Add HTML Anchors to Your Headings
Open your post in the WordPress block editor and click on an H2 heading. In the settings panel on the right, look for the Advanced section and expand it. You will see an HTML Anchor field. Type your short anchor name there, without the hash symbol. Repeat this for every H2 you want in the table of contents, and for any H3 subsections you want to include. You do not need to include every heading. A table of contents should show the main route through the post, not every small detail.
For example, a heading called How to Add Anchors could use this anchor:
how-to-add-anchors
When a reader clicks a link to that anchor, the browser looks for the matching name on the page and scrolls to it. If you are new to the editor and want a full tour first, our WordPress dashboard explained for beginners guide will help you find the settings panel and the Advanced section quickly.
One useful habit is to write your headings first, then add anchors, then build the list. If you change a heading later, the anchor stays the same unless you edit it, so your links keep working. That separation between the visible heading text and the anchor name is what makes the manual method reliable.
Step 2: Build the Link List at the Top of the Post
Place your cursor at the top of the post, just below the introduction or right after the first paragraph, and add a List block. Type the text of each section, then turn each line into a link. To link a line, select the text, click the link button, and type a hash followed by the anchor name, such as #how-to-add-anchors. Press Enter to confirm the link. Repeat this for every section.
Your finished list might look like this:
- What a table of contents does for readers
- How the manual method works
- Add anchors to your headings
- Build the link list
- Add smooth scrolling
- When a plugin is worth it
Add a short heading above the list, such as In This Article, so readers know what the list is. Keep the list short. Six to ten items is a good range for most posts. If your post has more sections than that, link only the H2 headings and leave the H3 subsections out of the table of contents. Readers can still find the subsections by scrolling through the section they opened.
Test every link before you publish. Click each item in the preview and check that it lands on the right heading. A broken jump link is worse than no table of contents at all, because it breaks trust in the rest of the post. If a link does nothing, check for a spelling difference between the link and the anchor, and check that you did not accidentally include a space in the anchor name.
Custom HTML Block Variation for More Control
If you want more control over the look of the list, or you want to reuse the same structure across posts, use a Custom HTML block instead of a List block. In a Custom HTML block you write the list as plain HTML links. Here is a small example you can adapt:
<ul>
<li><a href="#how-to-add-anchors">Add anchors to headings</a></li>
<li><a href="#build-the-list">Build the link list</a></li>
<li><a href="#smooth-scrolling">Add smooth scrolling</a></li>
</ul>
The Custom HTML version behaves the same way for readers, but it lets you add your own classes or wrap the list in a styled container if your theme supports it. For most beginners, the List block is easier and safer, because the editor handles the formatting for you. Use Custom HTML only when you have a specific design reason for it. Either way, the anchors and the links work in exactly the same way.
Add Smooth Scrolling With a Little CSS
By default, clicking a jump link moves the page to the section at once. That is fine, but a smooth scroll feels calmer and helps readers keep their place. You can add it with one small CSS rule. Go to Appearance, then Customize, then Additional CSS, and add this code:
html {
scroll-behavior: smooth;
}
Publish the change and test a jump link again. The page should glide to the section instead of jumping. If your theme already adds smooth scrolling, this rule will simply match what is there, so it is safe to add. If you later decide you prefer the instant jump, remove the rule and the links will go back to the default behavior. This is a good first example of how Additional CSS works, and our guide on how to add custom CSS in WordPress explains the same panel in more detail.
When Is a Plugin Actually Worth It?
The manual method is best for most small and medium sites. A plugin becomes worth considering only in specific cases. If you publish very long posts every day, a plugin saves real time by generating the list automatically. If you have hundreds of older posts and want a table of contents on all of them at once, doing it by hand would take weeks. If you need advanced features, such as a floating sidebar list, automatic numbering, or collapsible sections, a plugin may be the practical choice.
Even then, weigh the cost. Every plugin adds code, update work, and a small risk of conflict with your theme. If you only need a simple list on a handful of long posts, the manual method wins. Start manual, and only switch when the time saved clearly outweighs the extra weight.
How to Keep the Table of Contents Updated
A table of contents needs the same care as the rest of the post. Whenever you add a new section, add its anchor and add a link to the list. Whenever you remove a section, remove its link too. Whenever you reorder sections, reorder the list to match. This takes less than a minute if you do it at the same time as the edit, and it prevents the most common problem with manual lists: a list that no longer matches the post below it.
Make this check part of your publishing routine. Before you update a post, scroll through the table of contents and click each link once. If you publish new posts often, our checklist in things to do after installing WordPress is a useful reminder of the small setup habits that keep a site tidy over time. A short final check protects readers from dead jumps and protects you from publishing a post whose navigation is out of date.
Finally, remember that a table of contents is a reading aid, not a substitute for good headings. Write headings that describe what the section actually covers, in the words a reader would search for. For more on the hosting behind your content, see our web hosting guide.
Frequently Asked Questions
Do I need a table of contents on every post?
No. Short posts do not need one, because readers can see the whole post at a glance. Add a table of contents to longer posts, tutorials, and guides where readers are likely to look for one specific answer. For a short news post or a brief update, skip it and keep the page clean.
Should I include H3 subsections in the table of contents?
Only when it helps. For a very long guide, including H3 items under their H2 parent can help readers find a precise step. For most posts, H2 items alone are enough, and a shorter list is easier to scan. If your list grows past ten items, trim it back to the main sections.
Why does my jump link not work?
The usual cause is a mismatch between the link and the anchor. Check that both use the same spelling, the same hyphens, and no spaces. Also check that the link starts with a hash symbol and that the anchor field contains no hash symbol. If the anchor is on a heading inside a reusable block or a pattern, edit that block directly so the anchor is saved in the right place.
Will a manual table of contents slow down my site?
No, it is one of the lightest features you can add. It is just a short list of links and a few anchor names, with no extra scripts or database queries. That is one of the main reasons the manual method is a good choice for performance minded site owners. You can learn more about how WordPress handles content blocks in the official documentation at WordPress.org.
Last updated: October 2026.




One Comment