.docx MIME type
Word documentdocuments
application/vnd.openxmlformats-officedocument.wordprocessingml.documentModern Word documents — a ZIP archive of XML files.
| MIME type | application/vnd.openxmlformats-officedocument.wordprocessingml.document |
|---|---|
| Extensions | .docx |
| Content-Type | application/vnd.openxmlformats-officedocument.wordprocessingml.document |
| Compress in transit? | No — already compressed |
| File signature | 50 4B 03 04 (PK..) the ZIP signature — this format is a ZIP archive inside |
Good to know
- Because a .docx is a ZIP file, naive type detection by signature reports
application/zip. Check the extension or the archive's[Content_Types].xml. - Macro-enabled documents use
.docmand a different type:application/vnd.ms-word.document.macroEnabled.12.
Serve .docx files with the right type
The response header to send:
Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
Most servers pick the type from the file extension. If yours sends the wrong one, map it explicitly:
application/vnd.openxmlformats-officedocument.wordprocessingml.document docx;
AddType application/vnd.openxmlformats-officedocument.wordprocessingml.document .docx
res.set("Content-Type", "application/vnd.openxmlformats-officedocument.wordprocessingml.document");import mimetypes
mimetypes.add_type("application/vnd.openxmlformats-officedocument.wordprocessingml.document", ".docx")<input type="file" accept=".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document">
Check it
See what a server sends for a file, and what type a local file really is by its contents:
curl -sI https://example.com/file.docx | grep -i '^content-type:' file --mime-type file.docx
Frequently asked questions
What is the MIME type for .docx files?
application/vnd.openxmlformats-officedocument.wordprocessingml.document.
What Content-Type header should a .docx file be served with?
Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document. It's already compressed, so servers shouldn't gzip it.
How can I tell if a file is really a .docx?
Check its bytes rather than the extension: DOCX files start with 50 4B 03 04 (PK..) — the ZIP signature — this format is a ZIP archive inside. On the command line, file --mime-type name.docx does this for you.
Headers that go with it: Content-Type · Content-Disposition · X-Content-Type-Options