DevToolsmith

DOC MIME Type

application/msword is the MIME type for Word 97–2003 documents (.doc). Here is the Content-Type header to send, the file signature, and how to configure servers and code.

MIME type
application/msword
Extensions
.doc, .dot
Content-Type header
application/msword
Registered
Yes, with IANA
Compress with gzip
No, it is already compressed
Category
Documents

About Word 97–2003 document files

The old binary Word format is an OLE2 compound file, the same container as .xls and .ppt, so the first bytes alone don’t tell them apart. Word has saved .docx by default since 2007, but .doc files are still common in email attachments and archives.

  • Legacy .doc files can carry macros. If you accept them as uploads, scan them, and never open them on the server with Office automation.

File signature

DOC files start with D0 CF 11 E0 A1 B1 1A E1 (OLE2 compound file). The extension and the type a browser reports for an upload both come from the file name, so check these bytes on the server before trusting a file.

Serve .doc with the right Content-Type

Response header
Content-Type: application/msword
nginx (a line in the types { } block of mime.types)
application/msword doc dot;
Apache (.htaccess or server config)
AddType application/msword .doc .dot
Caddy
@doc path *.doc *.dot
header @doc Content-Type "application/msword"
Check what a server sends
curl -sI https://example.com/file.doc | grep -i '^content-type'
# Content-Type: application/msword

Set the type in code

Node.js (Express)
res.set('Content-Type', 'application/msword');
// Or make the browser download it:
res.attachment('file.doc');
Python
import mimetypes

mimetypes.add_type('application/msword', '.doc')  # if your system doesn't know it
mimetypes.guess_type('file.doc')[0]  # 'application/msword'
Go
mime.AddExtensionType(".doc", "application/msword")
w.Header().Set("Content-Type", "application/msword")

Accept .doc uploads

HTML
<input type="file" accept=".doc,.dot,application/msword">

The accept attribute only filters the file picker; users can still choose another file. Listing the extension as well as the type matters, because operating systems don’t always report the type you expect.

Related types

  • .docx (application/vnd.openxmlformats-officedocument.wordprocessingml.document): Word document
  • .rtf (application/rtf): Rich Text Format
  • .xls (application/vnd.ms-excel): Excel 97–2003 workbook

More documents

.pdf , .xlsx , .ppt , .pptx , .odt , .epub . Look up any extension or type with the MIME type lookup.

Sources

Spotted a mistake? Email hello@devtoolsmith.com and we’ll fix it.

Frequently asked questions

What is the MIME type for .doc files?

application/msword. The full header is "Content-Type: application/msword".

Why does my server send the wrong Content-Type for .doc?

Web servers pick the type from the file extension using a table (mime.types in nginx and Apache). If .doc is missing from that table, they send a default such as application/octet-stream or text/plain. Add the mapping as shown on this page, then check the response with "curl -sI".

How can I check that a file really is DOC?

Look at the first bytes rather than the extension or the type the browser reports, which both come from the file name. DOC files start with D0 CF 11 E0 A1 B1 1A E1 (OLE2 compound file). The MIME type lookup on this site reads them for you when you drop a file on it.