Word refuses to open your DOCX file and shows “The name in the end tag of the element must match the element type in the start tag.” An opening tag and a closing tag don’t match inside the document’s XML, but the content is usually still recoverable.
Fix #1: Use Word’s Open and Repair option
Word can repair minor XML damage without changing the original file. Start here.
- Create a copy of the damaged DOCX file and work with the copy.
- Open Microsoft Word without opening the document.
- Select File > Open > Browse.
- Select the damaged document.
- Click the arrow beside Open, then select Open and Repair.
Word should open the repaired document. Save it immediately under a new name, close Word, and open the new copy again to confirm it works.
If the error returns, continue with another repair method.
Fix #2: Resave the document in LibreOffice Writer
LibreOffice Writer uses a different DOCX parser and can sometimes open files Word rejects. Resaving the document creates a new XML structure around the recovered content.
- Install the current version of LibreOffice from its official website.
- Open LibreOffice Writer.
- Select File > Open.
- Choose a copy of the damaged DOCX file.
- Check the document for missing equations, text boxes, images, or formatting.
- Select File > Save As.
- Choose Word 2007-365 (.docx) as the file type.
- Enter a new filename and select Save.
- Confirm that you want to use the Word format if LibreOffice displays a compatibility warning.
The new DOCX should open in Word. So far, so good, but compare important equations and page layouts with any PDF or printed copy you have.
Fix #3: Resave the document through Google Docs
Google Docs can rebuild the DOCX package during import and export. Skip this method if the document contains private information that you can’t upload to a cloud service.
- Open Google Drive in your browser.
- Select New > File upload.
- Upload a copy of the damaged DOCX file.
- Right-click the uploaded file.
- Select Open with > Google Docs.
- Check whether the text and key objects loaded correctly.
- Select File > Download > Microsoft Word (.docx).
- Open the downloaded file in Word.
The downloaded copy should open without the tag mismatch. Check equations, comments, tracked changes, and floating objects because Google Docs may alter complex Word formatting.
Fix #4: Repair the document.xml file manually
A DOCX file is a ZIP archive containing XML files. Manual repair gives you more control, but I’d skip this step unless Open and Repair and both resave methods failed.
Show file extensions and open the DOCX package
- Create another copy of the damaged document.
- Open File Explorer.
- Select View > Show > File name extensions.
- Rename the copied file from
Document.docxtoDocument.zip. - Select Yes when Windows warns that changing the extension may make the file unusable.
- Right-click the ZIP file and select Extract All.
- Open the extracted folder.
You should see folders such as _rels, docProps, and word, plus XML files at the package’s top level.
Find the mismatched XML tag
- Open the
wordfolder. - Locate
document.xml.
- Create a backup copy of
document.xml. - Open the working copy in an XML-capable editor such as Visual Studio Code or Notepad++.
- Use the location shown in Word’s error dialog, such as
Part: /word/document.xml, Line: 2, Column: 12345, to find the damaged section. - Run the editor’s XML validation or formatting command to identify the mismatched opening and closing tags.
- Correct only the mismatched tag or misplaced element.
- Save
document.xml.
DOCX XML is often stored on one long line, so Word may report line 2 with a very large column number. Search near that position for equation elements such as m:oMath, especially when the paragraph also contains an anchored text box or graphic.
Each opening element must have the correct closing element. For example, <m:oMath> must eventually close with </m:oMath> in a valid position. Don’t delete namespace declarations or unrelated XML to make the validation warning disappear.
Rebuild the DOCX file
- Return to the folder containing
[Content_Types].xmland the extracted package folders. - Select everything inside that folder.
- Right-click the selection and choose Compress to ZIP file.
- Rename the new archive from
.zipto.docx. - Open the rebuilt DOCX file in Word.
The archive must contain [Content_Types].xml at its top level. If you compressed the parent folder instead, Word won’t recognize the result as a valid document.
If the file opens, save it under a new name and reopen it once. That second test confirms Word can parse the repaired XML after saving.
Fix #5: Prevent the tag mismatch from returning
This damage is associated with equations stored in the same paragraph as anchored text boxes or graphics. After recovering the document, separate those objects and update Word before editing further.
- Open Word and select File > Account.
- Select Update Options > Update Now.
- Let Word install available Microsoft 365 or Office updates.
- Reopen the recovered document.
- Select Home > Select > Selection Pane. The label or ribbon position may vary slightly with your current Word version and selected object.
- Select each text box or graphic near an equation in the problem section. Hold
Ctrlwhen you need to select multiple objects.
- Move the equation or anchored object into a separate paragraph.
- If several related text boxes need to stay together, select them and use Word’s Group command. Its ribbon tab and placement depend on the selected object and current Word version.
- Save the document under a new filename.
- Close Word and reopen the saved file.
The document should now open without the error. Keep equations and anchored graphics in separate paragraphs when changing the layout later.
When the fixes don’t work
A professional document-repair service or a dedicated DOCX repair utility may recover content when document.xml has widespread damage. If an older copy opens, restoring that version is safer than making broad XML changes.
Conclusion
Fix #1, Word’s Open and Repair, usually works when the XML damage is limited and is the solid choice to try first. Repeated errors after resaving point to a damaged equation or anchored object, while several broken files from the same drive can indicate storage trouble that needs attention. For more information on repairing corrupted files, you can visit What Is a Corrupted File and How Can I Fix It? or The Ultimate Guide to Repairing a Damaged or Corrupt Word File. You can also read Microsoft’s troubleshooting article on the end tag error for background on the equation and text box cause.