DevToolsmith

ODT MIME Type

application/vnd.oasis.opendocument.text is the MIME type for OpenDocument text documents (.odt) from LibreOffice and others. Here is the Content-Type header to send, the file signature, and how to configure servers and code.

MIME type
application/vnd.oasis.opendocument.text
Extensions
.odt
Content-Type header
application/vnd.oasis.opendocument.text
Registered
Yes, with IANA
Compress with gzip
No, it is already compressed
Category
Documents

About OpenDocument text files

OpenDocument files are ZIP archives too, but they make detection easy: the first entry is a file named mimetype, stored uncompressed, whose content is the MIME type itself. So the type is readable as plain text from byte 38. Spreadsheets (.ods) and presentations (.odp) work the same way with their own types.

File signature

ODT files start with 50 4B 03 04, then "mimetype" at byte 30. 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 .odt with the right Content-Type

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

Set the type in code

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

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

Accept .odt uploads

HTML
<input type="file" accept=".odt,application/vnd.oasis.opendocument.text">

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
  • .pdf (application/pdf): PDF document

More documents

.doc , .xls , .xlsx , .ppt , .pptx , .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 .odt files?

application/vnd.oasis.opendocument.text. The full header is "Content-Type: application/vnd.oasis.opendocument.text".

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

Web servers pick the type from the file extension using a table (mime.types in nginx and Apache). If .odt 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 ODT?

Look at the first bytes rather than the extension or the type the browser reports, which both come from the file name. ODT files start with 50 4B 03 04, then "mimetype" at byte 30. The MIME type lookup on this site reads them for you when you drop a file on it.