Most programmers know what a MIME type (or Media Type) is. It’s the two-part identifier used by programs to determine the format of a file or data. In web development, MIME types are most commonly seen in HTTP requests as the value of the
Content-Type header. But what do the two different parts mean and what are their valid values?
The first part of a MIME type is called the top-level media type and it specifies the general type of the data. The top-level media type can be one of the 7 standard defined types, which consist of:
- text - textual information.
- image - image data.
- audio - audio data.
- video - video data.
- application - some other kind of data, typically either uninterpreted binary data or information to be processed by an application.
- multipart - data consisting of multiple entities of independent data types.
- message - an encapsulated message.
The second part is called the sub-type and it specifies the specific format of the data. There are thousands of registered sub-types, far too many to list here. However there’s a list of registered MIME types on the IANA website.
The sub-type can also have one of the following optional prefixes to give it special meaning:
x-- Unregistered or experimental. Example:
vnd.- Vendor-specific. Example:
prs.- Personal or vanity. Example: