Many programs send different types of file across the Internet:
- Browsers display HTML pages that also include style sheets, scripts, images, audio and video
- Messaging apps are commonly used to send images, audio and video
- Email programs can receive many kinds of attachments
Media types tell these programs the format of files and their contents so that they can be processed and/or displayed correctly.
Media types were originally defined in a specification called Multipurpose Internet Mail Extensions and were called MIME types.
The name was changed to Media Types because they were not only used in emails, but also in many other internet protocols such as HTTP, and other document formats such as HTML. They are sometimes called content types.
They are controlled by the Internet Assigned Numbers Authority (IANA), who also control IP addresses, domain names, and other internet protocols.
A Media Type is made up of two parts separated by a forward slash:
- The type is a category of file format, such as audio, image, text, or video
- The subtype identifies the format of the file; for example, an image could be a GIF, JPEG, PNG, or WebP
There are two classes of type: discrete and multipart. Discrete types represent a single file or medium (such as a single piece of text, music or video), whereas multipart types represent a document composed of multiple parts.
Full list of media types: https://www.iana.org/assignments/media-types/
Discrete Media Types represent an individual file or medium. Below you can see the discrete types and some examples of their subtypes.
Image Media Type
image media type is used for image or graphical data including bitmap and vector images. It is also used for animated formats of still images such as GIF.
Audio Media Type
audio type is for audio files and music data.
|includes MPEG-based formats such as MP3|
|includes formats such as M4A (non-protected audio), M4B (audiobooks / podcasts) and M4P (DRM protected audio)|
|Advanced Audio Coding format|
|for transporting midi in Real-Time Protocol (RTP) packets|
Video Media Type
video type is for video files and data.
Text Media Type
text type is for text-only data that is designed either for humans to read or for computers to process.
|CSS style sheets|
Font Media Type
font type is used to specify font or typeface data.
|True Type font files|
|Open-Type font files|
|Web Open Font Format|
Application Media Type
application type is for files that are used by many types of applications, and that do not fall into one of the other types.
|Generic binary data, or unknown files|
Model Media Type
model type is for model data or 3D objects and scenes.
|Virtual Reality Modelling Language|
|Collada file format for 3D applications, written in XML|
Example Media Type
example type is used as a placeholder for examples that show how to use media types. They should only be used in sample code and documentation.
Multipart types are used for documents that are broken into pieces. This might be for one of two reasons:
- The individual pieces of the document have different Media Types
- A large field needs to be broken into parts for transmission, then re-assembled when it has been received
Below, you can see the two multipart media types.
message type is for messages that either include other messages (for example an email that contains a forwarded email), or for very large messages that are sent in chunks.
|For forwarded messages and replied-to messages|
|For parts of messages that are split up into chunks|
multipart type is used for data that will contain mutliple components that can have their own media type.
|Used to send form data that may also contain files|
Extra Information in Subtypes
Subtypes can use prefixes, suffixes and optional parameters to provide extra information.
The following three prefixes can be used at the start of a subtype. These prefixes are sometimes referred to as registration trees as they have more information about how the media types are registered with the IANA.
vnd.indicates that they are for use with software created by a specific vendor
prs.indicates that it is a personal or experimental format
x-indicates that they are unregistered with IANA
|X.509 security certificates|
When a file format is derived from either a standard or another file format, this can be indicated using a suffix.
To do this, the subtype is followed by a
+ symbol, then the name of the standard or format it is based on.
The examples show that the formats are written using Extensible Markup Language (XML).
|Indicates that SVG is written in XML|
|Indicates that MathML is written in XML|
|Indicates that the Atom feed is written in XML|
Parameters are specified by adding a semi-colon after the Media Type, followed by the name of the parameter, then an equals symbol, and then the value for the parameter.
|Indicates that the HTML file uses UTF-8 character encoding|
|Indicates that the MP4 video file uses AC-3 audio encoding|
For a full list of media types see: https://www.iana.org/assignments/media-types/
NOTE: Browsers use the media type of files, not their file extension, to determine how to process them. Therefore, web servers must be configured to send the correct media type in the response's
Content-Type header, otherwise the file may not be rendered or handled correctly.