Table of contents
The MIME type identifies the type of representation contained in the body of a HTTP request or response using the Content-Type header. MIME types were first used for email transmissions, as is evidenced by its full name: Multipurpose Internet Mail Extensions. Sometimes MIME types are also referred to as MIME media types or Internet media types.
The MIME type has a type and subtype separated by a slash (e.g. text/plain, image/gif, ...) and followed by one or more optional parameters. The major types are application, audio, image, text, and video. Application refers to a variety of formats. For example, application/pdf refers to Adobe Acrobat documents and application/octet-stream refers to an arbitrary binary stream.
A complete list of official MIME types can be found at IANA MIME type registry.
Character Sets
In addition to the major type and subtype, a MIME type may contain the specification for a character set. If the character set is omitted, the character set is determined by the major type: Latin1 for text/* and UTF-8 for application/*.
Since HTML is defined as MIME type text/html it is often provided with an character set specification in Content-Type headers.
Content-Type: text/html; charset=utf-8
XML MIME Types
The most common XML MIME types are application/xml and text/xml. Note that the latter is discouraged, because it uses the Latin1 character set by default. However, for XML MIME types, there is also a provision to allow for an infinite number of recognizable XML MIME types by using the +xml suffix (e.g. application/atom+xml, application/xhtml+xml, ...).
In general, XML MIME types are of the form application/*+xml with the notable exception of SVG, which is image/svg+xml.
Custom MIME Types
Custom MIME types can be created by following these conventions:
- Use
x.as prefix to the subtype for experimental MIME types. Note that thex-prefix is also valid for this purpose, but is discourage in favor ofx.to promote symmetry with other prefixes. - Use
vnd.as prefix to the subtypte for vendor specific MIME types which are part of a commercial product. Thevnd.prefix should be followed by the vendor name and subtype separated by a period (e.g.application/vnd.mozilla.xul+xml). - Use
prs.as prefix to the subtype for personal/vanity MIME types which aren't part of a commercial product.

Comments