logo
search
Office Settings & Configuration

How to Hide the TOC Field Code in Microsoft Word

Maira MehtabMaira Mehtab Sep 28, 2026 869 views

Question details

The user needs to switch from viewing the raw table of contents field code to viewing the actual formatted table of contents.

How to Hide the TOC Field Code in Microsoft Word
Product
Microsoft Word
Device & OS
not provided
Scenario
Reviewing or finalizing a document that contains an auto-generated table of contents.
Observed behavior
The document displays raw field code text (e.g., { TOC \o "1-2" \h \z \u }) on the page instead of the generated list of headings and page numbers.
Before you start

Ensure your keyboard is functioning properly, especially the Function (Fn) keys, as they are often required to execute the shortcut that toggles field code displays.

Solution 1Recommended

Toggle Field Codes Using Keyboard Shortcuts

Use the built-in Microsoft Word keyboard shortcut to instantly switch between displaying field codes and displaying their final formatted results.

This is the fastest method to resolve the issue. By default, Word uses a specific key combination to alternate between showing the background code of dynamic elements and their intended output.

1
Open the document

Launch Microsoft Word and open the document containing the raw TOC field code.

2
Locate the field code

Scroll to the section of the page where the { TOC \o "1-2" \h \z \u } text is currently visible.

3
Press the toggle shortcut

Press Alt + F9 on your keyboard simultaneously. If you are using a laptop or a compact keyboard with dual-function F-keys, press Fn + Alt + F9.

4
Verify the result

The raw code should disappear, replaced by your accurately formatted table of contents.

Toggle Field Codes Using Keyboard Shortcuts
Quick Fix: Using Alt + F9 toggles all field codes in the entire document simultaneously. If you only want to toggle the TOC code, click inside the code and press Shift + F9 instead.
Manage Documents with WPS Office

Seamlessly Create and Format Table of Contents in WPS Writer

WPS Writer handles complex document elements like table of contents and dynamic field codes flawlessly. You can easily toggle between field codes and results without compatibility issues, all in a lightweight and user-friendly interface.

  1. 1. Open Your Document: Launch WPS Writer and open your DOCX file containing the table of contents.
  2. 2. Toggle Field Codes: Just like in Word, you can right-click the TOC area and select 'Toggle Field Codes', or simply press Alt+F9 on your keyboard.
  3. 3. Update TOC: Navigate to the 'References' tab and click 'Update TOC' to ensure your page numbers and headings are perfectly aligned.
100% compatible with Microsoft Word DOCX formats and field codesEasily insert and update table of contents with a few clicksLightweight software that runs smoothly on older devicesFree to use with a familiar, easy-to-navigate ribbon interface
microsoft office alternative - wps office

Frequently Asked Questions

Why does my table of contents show as code instead of text?

This happens when your word processor is configured to show 'field codes' instead of field results. A table of contents is essentially a dynamic field code that pulls heading data. Pressing Alt+F9 toggles its visibility back to normal text.

Does Alt+F9 affect other fields in my document?

Yes, pressing Alt+F9 toggles the display setting for all field codes in the entire document, including hyperlinks, page numbers, and mail merge fields. To toggle only a specific field, select it and press Shift+F9.

How do I update the table of contents after hiding the field code?

Once the formatted table of contents is visible, you can right-click anywhere on the text and select 'Update Field'. You will be prompted to update either just the page numbers or the entire table.

What if Alt+F9 doesn't work on my laptop?

Many modern laptops map the Function row keys to media controls (like volume and brightness) by default. In this case, you must hold down the 'Fn' key in addition to 'Alt' and 'F9' (Fn + Alt + F9) to trigger the standard F9 command.