WWW FAQs: What are MIME types?

2004-10-19: similar to file extensions but more universally accepted, "MIME types" are used to identify the type of information that a file contains. While the file extension .html is informally understood to mean that the file is an HTML page, there is no requirement that it mean this, and many HTML pages have different file extensions.

In the HTTP protocol used by web browsers to talk to web servers, the "file extension" of the URL is not used to determine the type of information that the server will return. Indeed, there may be no file extension at all at the end of the URL.

Instead, the web server specifies the correct MIME type using a Content-type: header when it responds to the web browser's HTTP request.

Here are some examples of common mime types seen on the web:

TypeCommon File ExtensionPurpose
text/html.htmlWeb Page
image/png.pngPNG-format image
image/jpeg.jpegJPEG-format image
audio/mpeg.mp3MPEG Audio File
application/octet-stream.exeBest for downloads that should just be saved to disk
The Internet Assigned Numbers Authority website offers a complete listing of the official IANA-registered MIME types.

MIME stands for "Multimedia Internet Mail Extensions." MIME was originally invented to solve a similar problem for email attachments.

Legal Note: yes, you may use sample HTML, Javascript, PHP and other code presented above in your own projects. You may not reproduce large portions of the text of the article without our express permission.

Got a LiveJournal account? Keep up with the latest articles in this FAQ by adding our syndicated feed to your friends list!