Formatting Issues

How to Hide Page Numbers for Second-Level Headings in a Word TOC

Steven ParkerSteven Parker Nov 3, 2026 869 views

Question details

The user wants to display page numbers for top-level headings (Heading 1) in a Table of Contents while hiding them for second-level headings (such as an Author style).

How to Hide Page Numbers for Second-Level Headings in a Word Table of Contents
Product
Word
Device & OS
not provided
Scenario
Customizing a generated Table of Contents to selectively show or hide page numbers based on the specific heading level.
Observed behavior
By default, a Word Table of Contents displays page numbers for all included heading levels, which does not match the desired layout for the user's document.
Before you start

Ensure your document already contains a generated Table of Contents and that your headings are correctly formatted using Word's built-in or custom Styles.

Solution 1Recommended

Edit the TOC Field Code to Exclude Specific Page Numbers

Use Word's field code toggle feature to add an exclusion switch that hides page numbers for specific TOC levels.

Word uses field codes to generate the Table of Contents. By toggling these codes, you can append specific parameters (switches) to control exactly which levels display page numbers. The \n switch allows you to omit page numbers for a defined range of heading levels.

1
Display the Field Codes

Press Alt+F9 (or Alt+Fn+F9 on some laptop keyboards) to toggle the field codes in your document. Your Table of Contents will change to look similar to { TOC \o "1-3" \h }.

2
Add the Exclusion Switch

Click inside the brackets of the field code. Add the \n switch followed by the levels you want to exclude in quotation marks. For example, to hide page numbers for levels 2 and below, edit the code to look like: { TOC \o "1-3" \h \n "2-9" }.

3
Apply Settings for Custom Styles

If you are using a custom second-level style like 'Author' instead of standard headings, format the field code to map the style and exclude its page number. For example: { TOC \o "1-1" \h \z \t "Author,2" \n "2-2" }.

4
Update the Table of Contents

Press Alt+F9 again to hide the field codes. Click anywhere inside your Table of Contents and press F9. When prompted, select 'Update entire table' and click OK to apply the changes.

Edit the TOC Field Code to Exclude Specific Page Numbers
Shortcut Tip: If Alt+F9 does not work, you can also right-click the Table of Contents and select 'Toggle Field Codes' from the context menu.
Advanced Document Formatting

Customize Table of Contents Easily with WPS Writer

WPS Writer offers an intuitive interface to insert and customize your Table of Contents. You can adjust page number displays for different heading levels and map custom styles effortlessly.

  1. 1. Open your document: Launch WPS Writer and open the document where you want to add or modify a Table of Contents.
  2. 2. Navigate to the References tab: Click on the 'References' tab on the top ribbon and select 'Table of Contents'.
  3. 3. Insert and Customize: Click 'Insert Table of Contents'. From the dialog box, you can visually adjust which heading levels are included and whether their page numbers are aligned or displayed.
  4. 4. Map custom styles via Options: Click the 'Options' button in the TOC dialog to map custom styles (like 'Author') to specific TOC levels without manually typing complex field codes.
Intuitive Table of Contents settings for granular control over heading levels.Seamless compatibility with Microsoft Word (.docx) formats and field codes.Free, lightweight, and user-friendly interface for professional document formatting.
microsoft office alternative - wps office

Frequently Asked Questions

What does the \n switch do in a Word TOC field code?

The \n switch in a Table of Contents field code prevents page numbers from being generated for the heading levels specified in the quotation marks following it. For example, \n "2-9" hides page numbers for levels 2 through 9.

Why isn't my Table of Contents updating after I change the field code?

Changing the field code does not automatically refresh the visual Table of Contents. You must hide the field code by pressing Alt+F9, click anywhere inside the TOC, and press F9 to manually update it. Make sure to choose 'Update entire table'.

Can I hide page numbers for a custom style in the Table of Contents?

Yes. You can use the \t switch to map your custom style to a specific TOC level, and then use the \n switch to hide the page numbers for that specific level. For example, { TOC \t "MyStyle,2" \n "2-2" } maps 'MyStyle' to level 2 and hides its page numbers.