How to Inspect XML Inside DOCX and XLSX Files

Modern Microsoft Office formats, such as .docx and .xlsx, are packaged archives based on the Office Open XML (OOXML) standard. Instead of a single binary file, they consist of a collection of structured XML documents, relationship manifests, and embedded media compressed into a standard ZIP container. This guide details how to access, extract, and inspect these underlying XML structures using built-in operating system tools, archive managers, and specialized developer software.

Method 1: The Rename-and-Unzip Approach

The most straightforward way to view the XML contents without third-party software is by changing the file extension.

  1. Create a Backup: Make a copy of your .docx or .xlsx file to avoid modifying or corrupting the original document.
  2. Change the Extension: Rename the file extension from .docx or .xlsx to .zip (e.g., document.docx becomes document.zip). If file extensions are hidden, enable “File name extensions” in your operating system’s folder options.
  3. Extract the Archive: Use your system’s built-in extraction tool (such as Windows File Explorer or macOS Archive Utility) or any standard unzipping tool to extract the contents into a new folder.
  4. View the Files: Open the extracted folder to browse the XML files.

Understanding the Directory Structure

Once extracted, the folder contains several standardized subdirectories and XML files:

Method 2: Direct Inspection via Archive Managers

If you frequently inspect documents, renaming extensions can be inefficient. Third-party archive utilities (such as 7-Zip, WinRAR, or PeaZip) can inspect the package directly:

  1. Right-click the .docx or .xlsx file.
  2. Select your archive manager’s option to Open Archive without renaming the file.
  3. Double-click any .xml file to view it in your default text editor, or drag specific files out to examine them.

Method 3: Using Code Editors and Extensions

Modern code editors simplify browsing and formatting the underlying XML: