Word says your .docx file is unreadable, mentions an error in the content, and refuses to open it. Before you panic, know this: a .docx file is really a small package of files zipped together, and your text usually sits inside it in a readable form, even when Word itself cannot open the package.
This guide explains how to recover that text by opening the package and extracting its XML contents, step by step. You will not restore perfect formatting this way, but you can often save hours or days of writing.
Quick Answer
Work only on a copy of the broken file. Rename the copy from .docx to .zip, open it, and go into the word folder to find document.xml. Open that file in a browser or text editor, or change its ending to .txt, and your document text will be there among the XML codes, ready to copy into a fresh Word document.
Why This Works: What Is Inside a .docx File
Since Word 2007, a .docx file is not one single file. It is a ZIP archive holding several folders and XML files, which store your words plus codes for headings, paragraphs, and bold text.
The most important part is a file called document.xml, stored in the word folder inside the archive. It holds the main body text of your document. Other parts store styles, settings, headers, footers, footnotes, and images in the media folder.
Corruption often damages only one part of the package, such as the settings or a single broken code. Word then refuses the whole document, even though your sentences may be undamaged inside document.xml. Extracting them by hand bypasses Word’s strict checks. Microsoft explains the same idea in its Microsoft Support guide to recovering text from a damaged document.
Before You Start: Safety Rules
Recovery attempts can make a bad file worse if you work on the original. Follow these rules without exception.
- Copy the corrupted file and rename the copy clearly, for example Report-broken-copy.docx. Do all work on this copy only.
- Never rename, unzip, or edit your only original file. If an attempt fails, you need an untouched file for the next method or for a specialist.
- First, try Word’s own options on the copy: Open and Repair, and the Recover Text option described by Microsoft. Only use the XML method below when those fail.
- Check the file size. A 0 KB or tiny file probably contains no recoverable text.
Our guide to repairing a corrupted Word document covers those built-in Word repair options in full, so try them before or alongside this manual method.
Step 1: Make the Copy and Reveal File Extensions
- Put your copy of the file in an easy folder, such as a new folder on the Desktop called Recovery.
- Open File Explorer and choose View, then Show, then File name extensions, so you can see and change the .docx ending.
- Right-click the copy, choose Rename, and change only the ending from .docx to .zip. The name should now look like Report-broken-copy.zip.
- Windows will warn the file might become unusable. Confirm it. The file is a ZIP archive already, and you can change the name back at any time.
Step 2: Open the ZIP and Find document.xml
- Double-click the .zip copy. Windows opens it like a folder. If it will not open, try the free 7-Zip tool instead. A ZIP that refuses to open at all means deeper damage, which is covered later in this guide.
- Open the folder called word.
- Find document.xml. It is usually the largest file in that folder for a text-heavy document.
- Copy document.xml out of the ZIP and paste it into your Recovery folder on the Desktop. Do not edit it inside the ZIP.
- While you are there, look in the media folder inside word, or in the top-level folders, for images. Copy out any pictures you need, because the text extraction below does not save images.
What Else Is Worth Saving
Headers, footers, footnotes, and comments live in separate XML files such as header1.xml and comments.xml. If your document relies on them, copy those files out too and extract their text the same way.
Step 3: Read the Text Inside document.xml
You have three easy ways to read the file, from quickest to cleanest.
Option A: Open It in a Browser
- Right-click your copied document.xml, choose Open With, and pick your web browser.
- The browser shows the XML structure. Your text appears between codes such as <w:t> and </w:t>.
- Use Find (Ctrl + F) and search for a word you know is in the document to jump to real content past the opening codes.
- Select the text you need and copy it. You will copy some codes as well, which you can clean up after pasting, as explained below.
Option B: Read It as Plain Text
- Make another copy of document.xml and rename it to document.txt.
- Open it in Notepad with word wrap turned on, then scroll and copy your paragraphs. The text will be dense, because a whole document may appear as a few very long lines.
Option C: Clean the XML With Find and Replace
For a long document, cleaning the file first saves a lot of time.
- Open the .txt copy in a capable editor such as Notepad++ or the free VS Code.
- Use Find and Replace to replace the paragraph code </w:p> with a line break. In editors that support it, replace it with \r\n or use the extended search mode.
- Then remove the remaining codes. In Notepad++, search with regular expressions turned on, find <[^>]+> and replace it with nothing. This deletes every XML tag and leaves mostly plain text.
- Save the cleaned result as recovered.txt and read it through to confirm your chapters are all present, in order, from start to end.
Do the regular expression step only on your extracted copy, and check the result before deleting the uncleaned version.
Step 4: Rebuild a Clean Word Document
- Open Word and create a new blank document.
- Paste in your recovered text in sections if the document is long, so each part is easier to check.
- Remove any leftover codes or strange symbols by hand.
- Reapply simple formatting: headings, bold, lists, and page breaks. Do not try to recreate every original detail at once. Save the text first, format second.
- Reinsert the images you saved from the media folder in the right places.
- Save the new document with a fresh name as a normal .docx file, in a different folder from the broken original.
- Read the whole document once, checking the beginning, tables, and final page, where damage is most likely to hide missing text.
When the ZIP Will Not Open at All
Sometimes the archive itself is damaged and Windows refuses to open the .zip copy. Do not give up immediately.
- Try opening the copy with 7-Zip instead. It is more tolerant of small archive errors and can often extract files that Windows rejects.
- If 7-Zip shows an error on one file, extract everything else anyway. A damaged styles file does not matter if document.xml survives.
- Look for another copy in email, cloud backup, USB, or Word’s AutoRecover files.
- Consider professional help if the document is legally or financially critical and every copy fails.
Common Mistakes and Useful Tips
- Renaming the only original: The most common and most costly mistake. Always rename a copy, so you can return to a clean starting point.
- Expecting perfect formatting: This method recovers text, not design. Fonts, spacing, and complex tables must be rebuilt by hand. That is still far faster than retyping the document.
- Forgetting tables and text boxes: Text inside tables is in document.xml and usually recovers well, but text in some text boxes, headers, or footnotes lives in separate files. Check those files if something is missing.
- Pasting codes into the new document: Clean the text before or right after pasting, so leftover XML fragments do not confuse later editors.
- Saving over the broken file: Keep the broken original, the extracted XML, and the rebuilt document as three separate files until you are fully sure the recovery is complete.
Conclusion
A corrupted .docx feels like a disaster, but the package structure of the format works in your favour. Rename a copy to .zip, extract document.xml from the word folder, clean away the codes, and paste your recovered text into a fresh document. You will lose formatting, not your words, and for most people the words are what truly matter.
Frequently Asked Questions
Is it safe to rename a .docx file to .zip?
Yes, on a copy. A .docx file already is a ZIP archive with a different name, so renaming it does not change its contents. Windows will show a warning, but you can rename it back to .docx at any time and nothing is harmed.
Will this method recover my formatting and images?
Not automatically. This method is designed to save text. Images can be copied separately from the media folder inside the archive and reinserted by hand, but headings, fonts, and layout need to be reapplied in the new document.
What does document.xml look like, and how do I find my text?
It looks like long lines of code with your words mixed in. Your actual sentences appear between <w:t> and </w:t> markers. Use Find in your browser or editor and search for a phrase you remember from the document to jump straight to real content.
What if document.xml itself is damaged or missing?
Then this method cannot recover the main text from that copy. Look for another version of the file in backups, email, or AutoRecover, and try extracting from that copy instead. For a critical document with no other copy, a data recovery specialist is the safest next step.
Can I use this same trick for Excel or PowerPoint files?
Yes, the idea is similar. A .xlsx file stores sheet text in XML files inside its xl folder, and a .pptx file stores slide text inside its ppt folder. The file names differ, but working on a copy renamed to .zip is the same safe starting point.


Leave a Reply