Fix Word TOC Field Showing Raw Code Instead of Rendered Entries
🔍 WiseChecker

Fix Word TOC Field Showing Raw Code Instead of Rendered Entries

You open a Word document and instead of seeing a clean table of contents, you see text like { TOC \o "1-3" \h \z \u }. This raw field code replaces the expected list of chapter headings and page numbers. The issue occurs when Word displays the field code rather than its result, often because of a toggle setting, a corrupted field, or a document compatibility problem. This article explains why the TOC field code appears and provides step-by-step methods to restore the rendered entries.

Key Takeaways: Restoring a Visible Table of Contents

  • Alt+F9 (Toggle Field Codes): Switches all fields in the document between raw code and rendered result.
  • Right-click > Update Field: Forces a single TOC field to re-evaluate and display its content.
  • Ctrl+Shift+F9 (Unlink Field): Converts the TOC field to static text, removing the raw code permanently.

ADVERTISEMENT

Why Word Shows Raw TOC Field Code Instead of Rendered Entries

A table of contents in Word is a field. When you insert a TOC, Word creates a field code with instructions to gather headings and page numbers. Normally Word displays the field result, which is the formatted list. The raw code appears when Word is in field code display mode or when the field has become corrupted.

There are three common causes for seeing raw TOC field code:

Field Code Display Toggle Is Active

Word has a global toggle that shows field codes instead of field results for all fields in the document. This toggle is controlled by the Alt+F9 keyboard shortcut. If you or someone else pressed Alt+F9 by accident, every field in the document, including the TOC, cross-references, and page numbers, switches to raw code view.

Single Field Is Set to Show Codes

A single field can be set to display its code while other fields remain normal. This happens when you right-click a field and select Toggle Field Codes, or when the field is corrupted. In this case, only the TOC field shows raw code and other fields appear as expected.

Document Corruption or Compatibility Mode

Documents created in older versions of Word or converted from other formats may have field structures that Word cannot render correctly. The field code appears because Word cannot resolve the instructions. This also occurs if the document uses heading styles that were deleted or renamed after the TOC was inserted.

Steps to Convert Raw TOC Field Code Back to Rendered Entries

Use the following methods in order. Start with the simplest fix and move to more advanced steps only if needed.

Method 1: Toggle All Field Codes With Alt+F9

  1. Press Alt+F9 on your keyboard
    This key combination switches the display of all fields in the document. If the TOC was showing raw code because of the global toggle, it will now show the rendered entries. Check the TOC area to confirm the list of headings and page numbers appears.
  2. If the TOC remains as raw code, press Alt+F9 again
    Pressing Alt+F9 a second time toggles back to field code view. If the TOC is still raw code after the second press, the issue is not the global toggle. Move to Method 2.

Method 2: Update the TOC Field

  1. Right-click anywhere inside the TOC field code
    A context menu appears. The TOC field code is usually grayed when selected.
  2. Select Update Field from the context menu
    Word re-evaluates the TOC field. If the document headings are formatted with built-in heading styles, the field result replaces the raw code. If the TOC still shows code after updating, the field may be corrupted. Move to Method 3.

Method 3: Unlink the TOC Field

Unlinking converts the field to static text. The TOC will no longer update automatically, but the raw code disappears.

  1. Select the entire TOC field code
    Click and drag over the raw code, or place the cursor at the start and press Shift+End. Ensure the entire field code is highlighted.
  2. Press Ctrl+Shift+F9
    This keyboard shortcut unlinks the field. The raw code is replaced by the current result, which is the rendered TOC entries. Note that the TOC will not update if you change headings later. You must insert a new TOC field to regain dynamic behavior.

Method 4: Reinsert the TOC

  1. Delete the raw TOC field code
    Select the entire field code and press Delete on your keyboard.
  2. Go to the References tab on the ribbon
    In the Table of Contents group, click Table of Contents. Choose one of the automatic TOC styles from the dropdown menu. Word inserts a new TOC field based on the current heading styles in the document. The new field displays rendered entries immediately.

ADVERTISEMENT

If the TOC Still Shows Raw Code After These Fixes

Word Is in Field Code Display Mode Due to an Add-in

Some third-party add-ins or templates force Word into field code display mode. Open Word in safe mode to test this. Press Windows+R, type winword /safe, and press Enter. If the TOC renders correctly in safe mode, disable add-ins one by one in File > Options > Add-ins.

The Document Uses a Corrupted Heading Style

If the heading styles referenced by the TOC field are missing or corrupted, the field cannot resolve its instructions. Open the Styles pane with Ctrl+Alt+Shift+S. Verify that Heading 1, Heading 2, and Heading 3 exist and are applied to the chapter titles. Reapply the correct heading style to each heading, then update the TOC field using Method 2.

Field Code Is Locked for Editing

A document with restricted editing may lock the TOC field. Go to Review > Restrict Editing. If editing is restricted, click Stop Protection. Update the TOC field after removing restrictions.

Field Code Display Methods Compared

Item Alt+F9 Toggle Ctrl+Shift+F9 Unlink Right-Click Update Field
Scope All fields in document Single selected field Single selected field
Preserves dynamic updates Yes No Yes
Effect on other fields Toggles all fields Affects only the TOC Affects only the TOC
Best for Accidental global toggle Corrupted field that won’t render Normal field that needs refresh

You can now identify why a TOC field shows raw code and apply the correct fix. Start with Alt+F9 to check the global toggle. If that does not work, update or reinsert the TOC. For persistent cases, run Word in safe mode to rule out add-in interference. As an advanced tip, use the keyboard shortcut Ctrl+A then F9 to update all fields in the entire document at once, which can resolve hidden field display issues across large files.

ADVERTISEMENT