When you insert an automatic table of contents in Word, the TOC field includes all heading styles by default. If your document uses custom styles or non-heading styles that you want to keep out of the TOC, the default settings will not help. Word TOC field switches let you control exactly which style levels appear in the table of contents. This article explains how to use the \t switch and the \o switch to exclude specific style levels from your TOC.
Key Takeaways: Excluding Styles From a TOC With Field Switches
- \t switch in the TOC field: Lets you specify custom style names and the TOC level they map to, overriding the default Heading 1–9 mapping.
- \o switch with level range: Limits the TOC to built-in heading styles within a given level range, such as 1-3, excluding levels 4 and above.
- Alt+F9 to toggle field codes: Lets you view and edit the raw TOC field code, where you add or remove switches like \t and \o.
How TOC Field Switches Control Style Inclusion
A TOC field in Word uses switches to determine which paragraph styles appear in the table of contents and at which level. The default TOC field uses the \o "1-3" switch, which includes only the built-in Heading 1, Heading 2, and Heading 3 styles. If you have applied a custom style such as “Chapter Title” or a non-heading style such as “Normal” that you do not want in the TOC, you must modify the field switches.
The two most relevant switches for excluding styles are:
- \o “startLevel-endLevel” — Includes only built-in heading styles within the specified level range. For example,
\o "1-2"includes Heading 1 and Heading 2 but excludes Heading 3 and all other styles. - \t “StyleName,level” — Maps a specific style to a TOC level. You can list multiple style-level pairs separated by semicolons. This switch overrides the default heading style mapping for the styles you specify.
You do not need any special add-ins or permissions. Any Word user can edit the TOC field code directly.
Steps to Exclude a Specific Style Level From the TOC
Follow these steps to modify the TOC field and exclude a style. The example assumes you want to exclude Heading 3 from a TOC that currently shows Heading 1, Heading 2, and Heading 3.
- Display the TOC field code
Click anywhere inside the existing table of contents. Press Alt+F9 on your keyboard. The TOC field code appears, starting with{ TOC \o "1-3" \h \z \u }or similar. - Edit the level range in the \o switch
Change the level range from\o "1-3"to\o "1-2". This tells Word to include only Heading 1 and Heading 2 styles. Heading 3 and all lower heading styles are excluded. - Update the TOC to apply the change
Press F9 while the cursor is still inside the field code. Word prompts you to update the table of contents. Select Update entire table and click OK. The TOC now shows only Heading 1 and Heading 2 entries. - Hide the field code display
Press Alt+F9 again to return to the normal TOC view. The table of contents reflects the new level range.
Excluding a Custom Style Using the \t Switch
If you have a custom style such as “ChapterTitle” that you do not want in the TOC, you can use the \t switch to map only the styles you want. This method is useful when your document mixes built-in heading styles with custom styles.
- Open the TOC field code
Click inside the TOC and press Alt+F9. - Replace the \o switch with the \t switch
Delete the existing\o "1-3"switch. Type\t "Heading 1,1;Heading 2,2". This maps Heading 1 to level 1 and Heading 2 to level 2. No other styles are included. - Remove any existing \o switch
If the field still contains\oafter adding\t, delete the\oswitch entirely. Using both switches can cause unexpected behavior. - Update the TOC
Press F9 and choose Update entire table. The TOC now contains only Heading 1 and Heading 2 entries. The custom “ChapterTitle” style is excluded.
Excluding a Non-Heading Style From the TOC
If you accidentally applied a non-heading style such as “Normal” to headings, the TOC may include those paragraphs. To exclude them, you must either change the paragraph style back to a heading style or use the \t switch to map only the correct styles.
- Identify the style used on the unwanted TOC entry
Click inside the paragraph that appears in the TOC. Look at the Style gallery on the Home tab. Note the style name. - Open the TOC field code
Press Alt+F9 to show the field code. - Add the \t switch with only the styles you want
Replace the existing switch with\t "Heading 1,1;Heading 2,2;Heading 3,3". This includes only the three built-in heading styles. The “Normal” style is excluded. - Update the TOC
Press F9 and select Update entire table. The unwanted entries disappear.
Common Problems When Excluding Styles From the TOC
The TOC Still Shows Excluded Styles After Updating
This usually happens when the field code still contains the \o switch alongside the \t switch. Word evaluates both switches, and the \o switch may still include the built-in heading styles. Remove the \o switch entirely if you use \t. Also check that you did not accidentally type a space or comma incorrectly in the \t switch. The correct format is "StyleName,level" with a comma between the style name and the level number.
Custom Style Name Contains Spaces or Special Characters
Word requires the exact style name as it appears in the Styles pane. If the style name includes spaces, enclose the name in double quotation marks inside the switch. For example: \t "Chapter Title,1;Section Heading,2". If the style name contains a comma, Word cannot parse it correctly. Rename the style to remove commas before using it in a \t switch.
The TOC Entries Are Missing After Changing Switches
If the TOC appears empty or shows fewer entries than expected, the style names in the \t switch do not match the actual style names in the document. Open the Styles pane with Ctrl+Alt+Shift+S and verify the exact spelling of each style. Also check that the paragraph styles are applied consistently throughout the document.
TOC Field Switch Behavior: Built-in Heading Styles vs Custom Styles
| Item | \o Switch | \t Switch |
|---|---|---|
| Styles included | Only built-in Heading 1 through Heading 9 | Any paragraph style, including custom and built-in heading styles |
| Level range | Specified as start and end level, for example \o “1-3” | Each style maps to a specific level; no range is used |
| Excluding a style | Reduce the end level, for example change \o “1-3” to \o “1-2” | Omit the style from the list; only listed styles appear |
| Using both switches | Not recommended; Word behavior is unpredictable | Not recommended; Word behavior is unpredictable |
You can now modify the TOC field switches to exclude any style level from your table of contents. Start by pressing Alt+F9 to view the field code, then adjust the \o switch or replace it with the \t switch. Always update the entire table after making changes. For complex documents with many custom styles, use the \t switch to list only the styles you want. As an advanced tip, save the modified TOC field as a Quick Part or AutoText entry so you can reuse the same switch configuration in future documents without retyping the code.