A media type (also MIME type and content type) is a two-part identifier for file formats and format contents transmitted on the Internet. The Internet Assigned Numbers Authority (IANA) is the official authority for the standardization and publication of these classifications. Media types were originally defined in Request for Comments 2045 in November 1996 as a part of MIME (Multipurpose Internet Mail Extensions) specification, for denoting type of email message content and attachments; hence the name MIME type. Media types are also used by other internet protocols such as HTTP and document file formats such as HTML, for similar purpose.
As an example, an HTML file might be designated text/html; charset=UTF-8. In this example text is the type, html is the subtype, and charset=UTF-8 is an optional parameter indicating the character encoding.
Media type consists of top-level type name and sub-type name, which is further structured into so-called "trees". Media types can optionally define companion data, known as parameters.
top-level type name / subtype name [ ; parameters ]
top-level type name / [ tree. ] subtype name [ +suffix ] [ ; parameters ]
The currently registered top-level type names are: application, audio, example, font, image, message, model, multipart, text, video.
Sub-type name typically consists of a media type name, but it may or must also contain other content, such as tree prefix (facet), producer's name, product name or suffix - according to the different rules in registration trees.
Registrations in the standards tree must be either associated with IETF specifications approved directly by the IESG, or registered by an IANA recognized standards-related organization.
type / media type name [+suffix]
Examples: "application/xhtml+xml", "image/png"
The terms "vendor" and "producer" are considered equivalent in the context. Industry consortia as well as non-commercial entities can register media types in the vendor tree. A registration in the vendor tree may be created by anyone who needs to interchange files associated with some software product or set of products. However, the registration belongs to the vendor or organization producing the software that employs the type being registered, and that vendor or organization can at any time elect to assert ownership of a registration done by a third party.
type / '''vnd.''' media type name [+suffix] - used in the case of well-known producer
type / '''vnd.''' producer's name followed by media type name [+suffix] - producer's name must be approved by IANA
type / '''vnd.''' producer's name followed by product's name [+suffix] - producer's name must be approved by IANA
type / '''prs.''' media type name [+suffix]
According to RFC 6838 (published in January 2013), any use of types in the "x." tree is strongly discouraged. Media types with names beginning with "x-" are no longer considered to be members of this tree since January 2013.
According to the previous version of RFC 6838 - obsoleted RFC 2048 (published in November 1996) it should rarely, if ever, be necessary to use unregistered experimental types, and as such use of both "x-" and "x." forms is discouraged. Previous versions of that RFC - RFC 1590 and RFC 1521 stated that the use of "x-" notation for the sub-type name may be used for unregistered and private sub-types, but this recommendation was obsoleted in November 1996 by RFC 2048.
All media types should be registered using the simplified IANA registration procedures for vendor and personal trees or using the standards procedure for standards tree.
Media types that have been widely deployed (with an unfaceted sub-type name beginning with the "x-" prefix) without being registered, should be, if possible, re-registered with a proper faceted sub-type name. If this is not possible, the media type can, after an approval by both the media types reviewer and the IESG, be registered in the proper tree with its unfaceted name.
type / '''x.''' media type name [+suffix]
"+xml" suffix is defined since January 2001 (RFC 3023). Formal registration of "+xml" suffix and other suffixes is defined since January 2013 (RFC 6839).
Lines can be comments starting with the # character, or a mime-type followed by how to handle that mime type. The first part is called the content-type, and the second part is called the view-command. For example, video/mpeg; xmpeg %s says if a file encoded in mime has type video/mpeg, run the xmpeg program with the file name as a parameter.
When viewing a file, these two work together as follows: mime.types associates an extension with a MIME type, while mailcap associates a MIME type with a program.
In UNIX-type systems, the mime.types file is usually located at /etc/mime.types and/or $HOME/ .mime.types and the format is simply that each line is a space-delimited list of a MIME type, followed by zero or more extensions. For example, the HTML type can be associated with the extensions .htm, .html by the following line:
text/html htm html
#--Netscape Communications Corporation MIME Information # Do not delete the above line. It is used to identify the file type.