How to Corrupt a Word File for Testing (and How to Recover It)

Last updated on November 9th, 2026 at 01:44 pm

To make a test copy of a Word file that won’t open properly, copy the document, rename the copy from .docx to .zip, open the word folder inside it, delete a closing tag from document.xml, put the file back and rename it to .docx. Word then reports a problem when you open it, and you can practice the fix: File > Open > Browse, select the file, click the arrow next to Open and choose Open and Repair.

Applies to: .docx files in Word for Microsoft 365, Word 2024, Word 2021, Word 2019 and Word 2016 on Windows 11 and Windows 10. Mac differences are noted where they matter. The repair steps follow Microsoft’s own troubleshooting pages, linked in each section.

This is for IT staff, trainers, testers and anyone who wants to rehearse a recovery before a real document breaks, or check that an app or upload form rejects bad files cleanly. It isn’t a way to explain away a missed deadline: a broken submission usually just earns a request for a fresh copy.

Work only on a harmless copy

  • Work only on a copy. Right-click the document in File Explorer, choose Copy, and paste it into a new folder such as Corruption test on your desktop. None of the methods below touch any file except the copy you choose.
  • Use a harmless document. A few paragraphs of sample text, a heading and a table are enough. A test file with a little formatting shows you more clearly what each recovery method keeps and what it loses.
  • Name it clearly. Something like test-corrupt.docx keeps it from being mixed up with real work or attached to an email by mistake.
  • Turn on file extensions. You need to see the .docx part of the name to rename it. If you only see “test-corrupt,” follow the steps to show file extensions in Windows 11 (in File Explorer, View > Show > File name extensions).
  • Close the document in Word. Windows won’t let you rename or edit a file that Word has open.

Which test file should you make?

MethodWhat it imitatesBest for testing
1. Break the XMLMinor damage inside an otherwise intact fileWord’s repair prompt and Open and Repair
2. Cut the file shortA save interrupted by a power cut or a USB drive pulled out too earlyRecover Text, version history and backups
3. Fake .docxA file that was never a Word documentError messages in apps, upload forms and file scanners

If you’re training people, make all three. They fail in different ways, and seeing the difference is most of the lesson.

Method 1: Break the XML inside the .docx

A .docx file is a ZIP package of XML files. Microsoft’s page on Open XML formats and file name extensions explains that these files use ZIP compression and keep their parts separate, which is why Word can often rescue a file with one damaged part. Breaking the main text part gives you the most realistic repair test.

  1. Right-click test-corrupt.docx, choose Rename, change the ending to .zip and press Enter. Select Yes when Windows warns that the file might become unusable.
  2. Double-click test-corrupt.zip. File Explorer opens it like a folder. You’ll see folders named _rels, docProps and word, plus a file called [Content_Types].xml.
  3. Open the word folder and drag document.xml to your desktop. This makes an editable copy outside the ZIP.
File Explorer showing the word folder inside a renamed .docx ZIP file with document.xml highlighted
Inside the test ZIP’s word folder, drag document.xml to the desktop to make an editable copy. This original list-view illustration uses fictional test files and moves no real file.
  1. Right-click the desktop copy and choose Open with > Notepad. The text looks like one long line of tags; that’s normal.
  2. Press Ctrl + F, search for </w:body>, delete just that tag, and save with Ctrl + S.
  3. Drag the edited document.xml back into the word folder inside the ZIP and confirm that you want to replace the existing file.
  4. Close the ZIP window, then rename test-corrupt.zip back to test-corrupt.docx.

Double-click the file. Word should show an error instead of your document, typically saying it found unreadable content or a problem with the contents, and it may offer to recover the contents. Exact wording varies by Word version. That message is the moment you want to practice.

Word error dialog reporting a problem with the contents of test-corrupt.docx
A damaged XML part can trigger Word’s unreadable-content recovery prompt. This recreated example names test-corrupt.docx and leaves Yes and No pending; wording and recovery success vary by version and damage.

If you’d like a harder XML test, delete a closing tag from the middle of the file, such as one </w:p> (end of paragraph), instead of the body tag. More of the structure breaks, so the repair tends to keep less.

On a Mac, Finder unzips a .zip into a folder instead of opening it in place, and re-compressing that folder doesn’t rebuild the package the same way. Mac users are better off with Method 2 or Method 3.

Method 2: Cut the file short to imitate an interrupted save

Real damage often happens when a save is cut off halfway, so the file on disk is shorter than it should be. You can recreate that with a single command that writes a new file holding only the first half of your copy. The copy itself stays as it was.

  1. Open your Corruption test folder in File Explorer.
  2. Right-click an empty area of the folder and choose Open in Terminal. (In Windows 10, hold Shift, right-click, and choose Open PowerShell window here.) Make sure the window or tab is PowerShell, not Command Prompt.
  3. Paste this command and press Enter:

$b = [IO.File]::ReadAllBytes("$PWD\test-corrupt.docx"); [IO.File]::WriteAllBytes("$PWD\test-truncated.docx", [byte[]]$b[0..([int]($b.Length/2))])

A new file named test-truncated.docx appears, about half the size of the original. On a Mac, open Terminal in the folder and run head -c 20000 test-corrupt.docx > test-truncated.docx, which keeps the first 20,000 bytes (pick a number smaller than the file’s size, shown in Finder’s Get Info).

Expect a tougher result than Method 1. A ZIP package keeps its table of contents at the end of the file, so cutting the end off removes the part Word uses to find everything else. Open and Repair may fail, and Recover Text may return only scraps. That’s realistic: it shows why backups and version history matter.

Method 3: Give a non-Word file a .docx name

Copy any small text file or image into the test folder, rename it test-wrong.docx, and confirm the warning. Word will say it can’t open the file or that the file is corrupt.

This is the mildest test and is easy to undo (rename it back). It’s useful for checking how an app, website upload form or document scanner handles a file that isn’t what its name claims. It isn’t a recovery test, though: there’s no Word content inside, so nothing can be repaired.

How to recover the damaged file

Work through these in order, from the gentlest fix to the last resort. Try them on the test file first so the steps feel familiar when a real document fails. For deleted or never-saved documents rather than damaged ones, the steps to recover a Word document cover the other situations.

1. Open and Repair

  1. Open Word with a blank document and select File > Open > Browse. Don’t open the file from the Recent list; that skips the Open dialog box you need.
  2. Go to your test folder and click the damaged file once to select it.
  3. Click the small arrow on the right side of the Open button and choose Open and Repair.
Word Open dialog with the Open button menu expanded and Open and Repair highlighted
Select test-corrupt.docx in the test folder, open the arrow next to Open, and choose Open and Repair. This recreation follows the native eight-command Windows Word menu and performs no repair.

These are the steps on Microsoft’s page for opening a document after a file corruption error. If the document appears, use File > Save As and save it under a new name so you keep the damaged original for comparison.

2. Recover Text from Any File

  1. Select File > Open > Browse again.
  2. In the file type list next to the File name box (it usually says All Word Documents), choose Recover Text from Any File (*.*).
Word Open dialog file type list showing the Recover Text from Any File option
In the Windows Word Open dialog, expand the file-type list and choose Recover Text from Any File (*.*). The fictional selection is test-truncated.docx. This recreation follows a primary-source desktop list; available converters vary by installation.
  1. Select the damaged file and click Open.

Word pulls out whatever readable text it finds. Microsoft’s guide to troubleshooting damaged Word documents notes that formatting, graphics, fields and drawing objects are lost, while headers, footers, footnotes and endnotes come through as plain text. Delete any stray symbols at the start and end, then save it as a normal Word document.

Word for Mac: Microsoft’s Recover files in Office for Mac page uses a slightly different route. Choose Word > Preferences (the menu may say Settings on newer Macs) > General and turn on Confirm file format conversion at Open. Then select File > Open, choose Recover Text at the bottom right of the Open window, and open the damaged file.

3. Insert the file into a new document

Sometimes Word will bring in content as an insert even when it refuses to open the file directly. Create a new blank document, then on the Insert tab select the arrow next to Object and choose Text from File. Pick the damaged file and select Insert. You may need to reapply formatting to the last part of the document.

4. Copy the text straight out of document.xml

For a .docx with damaged XML (Method 1), make another copy, rename it to .zip, and open word\document.xml in Notepad or a web browser. Your words sit between <w:t> and </w:t> tags. It’s tedious for long documents, but it works when Word refuses everything else. It won’t help with a truncated file (Method 2), because Windows usually can’t open the cut-off ZIP at all.

5. Go back to an earlier version

  • OneDrive or SharePoint: right-click the file on the OneDrive website, or in File Explorer if the OneDrive app syncs it, and choose Version history. Select the three dots next to a version from before the damage and choose Restore. Microsoft’s page on restoring a previous version in OneDrive says versions are kept for 30 days, and that work or school administrators can turn versioning off.
  • File History: if File History backs up to an external drive or network location, right-click the folder that holds the file in File Explorer and choose Restore previous versions. Pick a version from before the damage, then expand Restore and choose Restore to so you don’t overwrite the current file.
  • AutoRecover: for edits that were never saved, select File > Info > Manage Document > Recover Unsaved Documents. AutoRecover can’t fix a file that was already damaged when it was saved, but it can hold a newer copy of your work than the broken file.

Mac users looking for the AutoRecovery folder can follow the steps for recovering an unsaved Word document on Mac.

Is it legal to corrupt a Word file?

Damaging your own test copy is fine. Passing off a deliberately broken file as an honest mistake to a teacher, client or employer can break school or workplace rules, and it doesn’t buy much time, because the usual response is a request to resend.

Why does the file open fine in Word for the web or another app?

Different programs are stricter or more forgiving about broken XML. A file that one app reads may fail in another. If you’re testing for a specific workflow, test in the exact app and version your team uses.

Are online “corrupt file generator” tools safe?

Some browser-based generators say they process files locally, but you can’t easily check that. Don’t upload real or confidential documents. A dummy file with sample text, or the methods above, avoids the question entirely.

What your test results tell you

  • Open and Repair brought back everything: Word’s own repair handles minor damage. Make sure everyone on the team knows the arrow next to Open exists, because it’s easy to miss.
  • Only Recover Text worked: the words survive but the layout doesn’t. For documents with complex formatting, regular backups matter more than repair tools.
  • Repair failed, but version history or File History worked: your backup setup is doing its job. Note how long the restore took.
  • Nothing worked: this is the gap to fix now, before a real file is lost. See the prevention steps below.

Clean up after testing

  1. Close Word so none of the test files are open.
  2. Delete the whole Corruption test folder, including test-corrupt.docx, test-truncated.docx, test-wrong.docx and any desktop copy of document.xml.
  3. Open your original document normally to confirm it’s untouched. It should open without any warning, since none of the methods changed it.

How to protect real documents

  • Store important files in OneDrive or SharePoint with AutoSave on. Every save becomes a version you can return to. If the switch is grey, these steps to turn on AutoSave in Word explain why.
  • Keep AutoRecover on with a short interval. In Word, go to File > Options > Save and set Save AutoRecover information every to 5 minutes or less, which is the interval Microsoft recommends. The AutoRecover settings page also shows where to change the AutoRecover file location.
  • Turn on a backup copy for local files. Under File > Options > Advanced > Save, select Always create backup copy. Word then keeps the previous save as a “Backup of” file with a .wbk extension.
  • Eject USB drives before unplugging them, and don’t edit documents straight from a USB stick or an email attachment; save them to your PC first.
  • Keep Word and Windows updated. Microsoft lists this as the first step before troubleshooting a damaged document.
  • Check the drive if damage keeps happening. Repeated corruption across many files points to a disk or system problem, not Word. Here’s how to check for and fix corrupted files in Windows 11.

Run Method 1 and Method 2 once, note which recovery step worked for each, and write the steps somewhere your team can find them. Then check that the documents you’d hate to lose are actually saved somewhere with version history.