DOCX Metadata: How to View, Edit and Remove It Safely
Understand which DOCX metadata is useful, sensitive or required for correct rendering.
The Two Layers of DOCX Metadata
A .docx file stores metadata in two distinct locations, each governed by different parts of the ECMA-376 specification. Modifying one layer never affects the other, but each carries separate risks.
Package-level metadata resides in docProps/core.xml inside the ZIP archive. This file contains Dublin Core elements (dc:creator, dc:created, dc:modified) and application-specific fields (meta:last-printed, meta:revision). Per the Open Packaging Convention (ISO/IEC 29500-2), every element in core.xml is optional. Word, LibreOffice, and file managers expose these fields in document properties dialogs. Search indexing and document management systems rely on them.
Document-level metadata resides in word/document.xml as attributes on the root <w:document> element. These attributes control rendering behavior: w:rsidR (revision session ID for the document), w:rsidRoot (the originating session), w:rsidP (paragraph-level session), and w:rsidRPr (run property revision session). ECMA-376 Part 1 §17.14.18 specifies that RSID values "correlate modifications within a session." They are required for correct display of tracked changes, paragraph formatting coherence, and document comparison. Removing them does not prevent opening the file, but Word will treat every change as belonging to a new session, collapsing color differentiation and breaking merge logic.
Identifying Sensitive Metadata Before Modification
Audit what is present before removing anything. A .docx file that has never been printed will lack meta:last-printed and meta:print-date entirely. Their presence reveals physical or virtual print timestamps.
Inspect docProps/core.xml directly with a ZIP-aware tool. Fields to check:
dc:creator— auto-filled from the Word installation user name at document creationdc:contributor— accumulates names when multiple authors save the filemeta:last-printed— timestamp of last print operationmeta:revision— integer incremented on every save, not every edit. A document saved 200 times but edited only 10 will showmeta:revision="200"cp:keywords— may contain tags or sensitivity labels applied by compliance tools
For document-level RSID data, inspect word/document.xml for w:rsidR attributes on the root element and w:rsidP on individual paragraphs. If tracked changes are present, word/comments.xml and files under word/revisions/ contain w:author attributes with usernames and timestamps not visible in package metadata.
Safe Removal: What to Strip and What to Keep
Safe to remove (no rendering impact)
dc:creator,dc:subject,dc:description— informational only. Word displays empty fields in Properties when these are absent.meta:last-printed,meta:print-date— absence causes no error. Word will not populate them on next print unless the application is configured to do so.cp:keywords— no functional dependency.meta:revision— removing this resets the count to 1 on next save. Word regenerates the value.
Risky to remove (may affect rendering or tracking)
w:rsidRandw:rsidRoot— required by ECMA-376 for session identity. Stripping them fromword/document.xmlcauses tracked changes to display all edits in a single color and prevents Word from differentiating edit sessions in the review pane.w:authorinword/comments.xmlor revision files — removing the attribute while preserving the comment text causes Word to display "Unknown Author." In some versions, the comments pane fails to load if the attribute is malformed rather than absent.
Unrecoverable if removed
w:rsidP— paragraph-level RSID values. If the document uses outlining or numbering tied to paragraph identity, removing these can collapse numbered lists into a single sequence. No automatic repair exists; numbering must be regenerated manually.w:conformanceon the<w:document>root element — specifiesstrictortransitionalconformance class. Removing it defaults to transitional, which may shift layout for features that behave differently under strict conformance, such as margin containment.
Viewing Metadata Without Application Software
A .docx file is a ZIP archive. Inspection requires only a file browser and a text editor, bypassing application-level filtering that hides certain fields.
- Rename the file from
document.docxtodocument.zip. - Open the archive and navigate to
docProps/core.xml. - Open the XML file in any text editor. All metadata is human-readable.
- For RSID data, extract and examine
word/document.xml.
Word's Properties dialog does not display meta:revision or cp:keywords when they are empty, but the raw XML shows them. This method also exposes orphaned metadata from deleted comments or tracked changes that Word's UI suppresses.
Editing Metadata with Precision
Package-level: docProps/core.xml
The structure follows Dublin Core namespaces inside a <cp:coreProperties> root element. To change the author, edit the value inside <dc:creator>. To add a subject, insert <dc:subject>Your Subject</dc:subject> as a child of <cp:coreProperties>. The XML must remain well-formed; an unclosed tag causes Word to reject the file as corrupt.
Encoding constraint: After editing, save the file as UTF-8 without BOM. Word's parser on macOS rejects a BOM and opens a blank document. On Windows, the file may open but metadata fields will be unreadable.
Document-level: word/document.xml
RSID values follow the pattern w:rsidR="00A1B2C3" — exactly eight hexadecimal digits. If you change a value, it must remain unique within the document. Two paragraphs sharing the same RSID cause Word to merge their tracked changes into a single session, producing incorrect revision history.
To remove a single author's identity from comments, locate <w:comment w:id="0" w:author="John Doe"> in word/comments.xml. Either delete the w:author attribute entirely or replace its value with a generic string such as w:author="Author". The comment text and w:date timestamp remain intact.
Automated Sanitization Workflow
A batch process follows three steps: extract, modify, rebuild. The script below uses standard command-line tools and logs failures per file.
#!/bin/bash
# sanitize-metadata.sh
# Usage: ./sanitize-metadata.sh input_folder output_folder
INPUT=$1
OUTPUT=$2
LOGFILE="sanitization_log_$(date +%Y%m%d_%H%M%S).txt"
mkdir -p "$OUTPUT"
for file in "$INPUT"/*.docx; do
filename=$(basename "$file")
tempdir=$(mktemp -d)
# Step 1: Extract
unzip -q "$file" -d "$tempdir" 2>> "$LOGFILE"
if [ $? -ne 0 ]; then
echo "FAILED: $filename - unzip error" >> "$LOGFILE"
rm -rf "$tempdir"
continue
fi
# Step 2: Modify core.xml
if [ -f "$tempdir/docProps/core.xml" ]; then
sed -i \
-e '/<dc:creator>/d' \
-e '/<dc:subject>/d' \
-e '/<meta:last-printed>/d' \
-e '/<cp:keywords>/d' \
"$tempdir/docProps/core.xml" 2>> "$LOGFILE"
fi
# Step 3: Rebuild
cd "$tempdir"
zip -q -r "$OUTPUT/$filename" . -x "*.xml~" 2>> "$LOGFILE"
if [ $? -ne 0 ] || [ ! -f "$OUTPUT/$filename" ]; then
echo "FAILED: $filename - zip error" >> "$LOGFILE"
rm -f "$OUTPUT/$filename"
else
echo "OK: $filename" >> "$LOGFILE"
fi
cd - > /dev/null
rm -rf "$tempdir"
done
Validation: After sanitization, re-extract each output file and confirm that docProps/core.xml contains no <dc:creator>, <dc:subject>, <meta:last-printed>, or <cp:keywords> elements. Do not validate against a schema that expects these elements — they are optional per ISO/IEC 29500-2, so their absence is conformant. A schema validator that treats them as required will produce false failures.
Hard limits and failure modes: The log records each file with OK: or FAILED: and the specific error. Password-protected ZIP archives cause unzip to exit with code 82. Truncated files produce "unexpected end of archive." Non-UTF-8 XML files may be corrupted by sed when non-ASCII characters span byte boundaries. These failures are unrecoverable without the original source file or a repair tool that parses the DOCX structure.
Verification After Modification
Confirm three conditions before distributing a sanitized file:
Open in a compliant viewer. Open the file in Word or LibreOffice. If no warning dialog appears, the ZIP structure and XML syntax are intact. A corrupt archive or malformed XML produces an immediate error on open.
Check the metadata layer. Re-extract
docProps/core.xmland verify the removed fields are absent. Confirm thatdcterms:createdanddcterms:modifiedstill contain valid ISO 8601 timestamps (pattern:YYYY-MM-DDTHH:MM:SSZ). An empty or malformed date field causes indexing errors in SharePoint and other document management systems.Test tracked changes. If the original document had tracked changes, enable "Track Changes" in Word and make a small edit. The new edit must appear in a color different from previous edits. If all edits share one color, RSID data required for session differentiation has been removed. The file is not corrupt, but collaborative review functionality is degraded.
Reference: Microsoft Open Specifications — DOCX