January 22, 2016
MIME stands for Multi-purpose Internet Mail Extensions. Though, the use of the word MIME has evolved to encompass data transactions outside the realm of web mail. Back in the day, MIME types simply defined content delivered between mailing servers and clients (Outlook) for 1-on-1 communication. But now they are used by clients like browsers (Chrome) to interpret global communication.
A Simple Explanation of MIME Types
Here are some basic examples of how MIME types are displayed:
Using the last example: The MIME value of
application and the “subtype” is
Why We’re Talking About MIME Types
In November 2015, MaxCDN’s Justin Dorfman and his partner Josh Mervine ran into a dilemma when rewriting
Although the IETF only considers
A Technical Explanation of MIME Types
Most operating systems like Microsoft Windows, Mac OS X, or the various Linux distributions identify file types through file name extensions – usually the three characters following the dot ending a file name (example: .doc).
Likewise, an operating system associates applications that should read and edit certain file types. For example, in Microsoft Windows we typically would see Microsoft Word opening a file ending with the .doc extension (
application/msword), and an image viewer would open a file with the .jpeg extension (
The equivalence of “filename extensions” on the Internet is provided by MIME types. They tell web browsers and email clients what type of files they are dealing with so the application knows how to process the file. Just the way operating systems associate default programs and actions to file name extensions, applications on the Internet make use of the MIME types.
MIME types are defined in two parts, having a “type” and a “sub-type” as described in the first section of this article. If you look at the HTTP header of a PNG image, you’ll see the MIME type defined in the
Content-Type field. Here is the HTTP header of an image file from the MaxCDN Blog:
HTTP/1.1 200 OK Date: Sun, 10 Jan 2016 12:56:04 GMT Content-Type: image/png Content-Length: 2075
The MIME type is
image/png. That tells the browser the resource is of type “image” and sub-type “png”, which we usually refer to as the image format. The browser can then decide on how to display the image, whether it can display or does not have the required technology to display such type of image. This is more common with audio and video types.
The ability to categorize resources in types and sub-types gives applications a unique advantage to provision when displaying web content. For example, if a browser receives a file from a web server of type
audio/xyz, it might not have the required plugin to play. But because the browser at least understands it’s an audio file, it can prompt the user accordingly.
Content-Type field may carry additional information called “arguments” and there may be several arguments for the MIME type. One example of an argument is the character-set information for the
text/html type. Here is a part of the HTTP header from the MaxCDN Blog showing the
HTTP/1.1 200 OK Date: Sun, 10 Jan 2016 13:07:47 GMT Content-Type: text/html; charset=UTF-8
Content-Type field accepts several arguments and their order is not important. In the above header extract, the argument is “charset=UTF-8”. The browser thus interprets the resource as text of sub-type
html and the character set required is
There is an official list of MIME Types published by the Internet Assigned Names and Numbers Association (IANA), which is regularly updated. The list contains MIME types that have been reviewed by the association.
Experimental MIME Types
MIME Type Resources
Technical standards by the IETF have lengthily described the MIME format. I recommend that Internet geeks be familiar with the following RFCs:
- RFC 2045 – MIME, Format of Internet Message Bodies
- RFC 2046 – MIME, Media Types
- RFC 2047 – MIME, Message Header Extensions for Non-ASCII Text
- RFC 4289 – MIME, Registration Procedures
- RFC 2049 – MIME, Conformance Criteria and Examples
And here are some MIME types lists:
Ish Sookun is a Linux enthusiast and a Free & Open Source Software advocate. He works as a Linux System Administrator at a leading media group in Mauritius where he builds http://www.lexpress.mu/. In his free time, you can find him writing about Linux, Ubuntu, and programming on his blog Hacklog.