Align Page Numbers in a Word Table of Contents

Line up the page numbers in a table of contents with a right-aligned tab stop and dot leaders, then keep that alignment after you update the TOC.

A table of contents that looks neat on one page can fall apart on the next. The page numbers sit at different horizontal positions, some dots run into the text, and the column looks ragged. This usually happens because the entries were spaced by eye, not because the document is broken. Aligning page numbers in a table of contents is a layout task, and it has a clear fix.

This guide is for anyone working in a Word document (.docx) who wants the page-number column to sit in a straight line. It covers the method most people need: a right-aligned tab stop with dot leaders, applied in a way that survives updates. It does not cover wrong page numbers or numbering schemes, which are separate problems.

You will set one tab stop, check each entry for stray spaces, and confirm the result in an exported PDF. If you work in a browser or in the OmniDoc desktop client, the same checks apply to the .docx file you open there.

How do you align page numbers in a table of contents? The short answer

Use a right-aligned tab stop at your right margin with dot leaders, and separate each heading from its page number with a single tab character. The page numbers then share one right edge, whatever their length.

Your situationWhat to doWhy
The TOC was generated from heading stylesSet the right tab in the TOC 1, TOC 2 and TOC 3 stylesUpdating the table then keeps the alignment
You typed the TOC by handReplace spaces before page numbers with one tab, then set the tab stopA tab jumps to a fixed position; spaces do not
Two-digit and three-digit page numbers do not line upConfirm the tab is right-aligned, not left-alignedRight alignment anchors the end of the number, so length does not matter
Nested headings are shiftedIndent the sub-entries with the left indent, and keep the right tab for the numberIndent moves the heading text; the tab still controls the number

Before you start

Check these items first. Each one prevents a problem that a tab stop alone will not fix.

  • Whether the TOC is a generated field or typed text. A generated table updates itself and can overwrite manual formatting. Look at the table after you click into it: if it shades as one unit, it is probably a field. You can apply formatting to the TOC styles, which survives updates, instead of formatting each line by hand.
  • Your right margin position. The tab stop has to sit at the right edge of the text area, or the numbers will hang past the margin or stop short of it. Use the page setup measurements in your word processor, not a guess.
  • Formatting marks. Turn them on so you can see tab characters and spaces. Without them, a stray space looks identical to a tab.
  • Your heading list. Make sure every heading uses a heading style. Entries that use plain body text will not pick up the TOC styles you set.
  • A saved copy. Work on a copy of the file. Tab and style changes are easy to undo, but a copy protects you if an update goes wrong.

Setting the page-number tab, step by step

  1. Turn on formatting marks. Show tab characters and spaces so you can see what sits between each heading and its page number.
  2. Find the stray spaces. Look for runs of spaces before page numbers and delete them. Keep one tab character in each gap.
  3. Open the paragraph settings for the TOC entries. Use the tab stop setting in the paragraph options. Your word processor's help menu will show where it lives.
  4. Add a right-aligned tab stop at the right margin. Enter the margin position as the tab location and choose right alignment, so each number ends at the same edge.
  5. Add dot leaders. Pick a leader style with dots. The dots carry the reader's eye from the heading to its page number, which helps longer lists read cleanly.
  6. Apply the setting to the TOC styles. Put the tab stop in the TOC 1, TOC 2 and TOC 3 styles, not only on the lines you can see. This way, updating the table reapplies the same alignment.
  7. Update the table and check the result. Refresh the TOC so every entry picks up the style. Then scroll through the whole table and confirm the numbers still line up.

Check the result

Look at the finished table before you share it. Use this list to find problems and fix them at the source.

CheckHow to see itIf it's wrong
Numbers share one right edgeScroll the TOC and compare the last digit of each entryConfirm the tab stop is right-aligned and sits at the margin
One tab per entryTurn on formatting marks and look between heading and numberReplace extra spaces or double tabs with a single tab
Dot leaders run unbrokenLook for gaps between dots and numbersReapply the leader style to the tab stop
Alignment survives an updateRefresh the table and compare againMove the tab stop into the TOC styles, then refresh
Nested entries are indentedCompare level 2 headings with level 1Adjust the left indent for that TOC style

To confirm the layout outside your editing program, export the document to PDF and read the TOC in the PDF. A PDF shows the page layout the reader will see, which can differ slightly from the editing view. If you open the .docx in the UniDoc web editor at app.unidoc.top, check the same lines there as well.

❓ FAQ

1. Why do my page numbers still look uneven after I set a tab stop?

The tab stop may be left-aligned, or some entries may have spaces instead of a tab. Confirm the stop is right-aligned, then turn on formatting marks and remove any spaces before the numbers.

2. Should I use spaces or tabs to space out the page numbers?

Use one tab character. Spaces depend on the font and size, so they drift when the text changes. A tab jumps to the stop you set, and the numbers stay in line.

3. Why does the alignment reset when I update the table?

The tab stop was probably added to individual lines, which the update replaces. Put the tab stop in the TOC 1, TOC 2 and TOC 3 styles, then update again.

4. Can I fix alignment directly in a PDF?

The PDF editor in the OmniDoc desktop client can edit paragraph text in place, but it does not move or realign page-number columns. Fix the alignment in the source .docx, then export the file to PDF again.

5. How do I keep the table aligned when I have very long headings?

Long headings can wrap onto a second line, which pushes the page number down or out of line. Shorten the heading text, or check that the tab stop leaves room for it before the number.

📝 Summary

Aligning page numbers in a table of contents comes down to one right-aligned tab stop with dot leaders, one tab per entry, and the setting placed in the TOC styles. Update the table, then check the exported PDF so the numbers line up in the version readers will see.

Open OmniDoc to edit and export your documents

Updated 2026-11-04