Understanding MIME Types in 2 Minutes

NicolasBrondinBernard

Author
@NicolasBrondinBernard

They are used everywhere, and especially on the web—the MIME standard is simple to understand, but essential!

Article published on 02/10/2023, last updated on 10/08/2026

The acronym MIME stands for "Multipurpose Internet Mail Extension", it's a standard that allows you to specify the type of a media/file, originally used for files sent as an email attachment.

Sometimes people simply refer to them as "media types"

Today many technologies rely on the MIME standard, this is notably the case for the HTTP protocol.

The format

A MIME type is very flexible in terms of content, because it allows you to define custom media types, but it's essential to respect its format.

Each media is defined by:

  • a type
  • a subtype
  • a parameter (optional)

In the following format:

# format
<type>/<subtype>;[parameter]

# example
image/png

# example with parameter
text/html;charset=UTF-8

Most MIME types do not require a parameter, but it's important to know that this exists.

Custom subtypes

What has allowed the MIME standard to remain valid after so many years is the fact that it is easily extensible.

There are ten main types, including notably:

  • application
  • image
  • video
  • text

But the formats themselves can be customized through suffixes.

For all non-standard formats, the prefix to use is "x", as for example for .ico files:

image/x.icon

And for proprietary formats, like those from Microsoft, the "vnd" prefix is used, for "vendor":

application/vnd.ms-excel

Note that sometimes the prefix is separated by a "-" instead of a "."

Standardization

Some file formats that gain traction are added to the standard after a certain time.

This is the case for Markdown files, which went from text/x.markdown to text/markdown.

Why not use the file extension?

It's true that most files have a name ending with an extension representing their format, like an-example-picture.png

But there are many situations where the file is accessible simply with an identifier

Let's imagine the following fictional URL: https://example.com/images/user34

The browser will not be able to correctly interpret this file to display it if it isn't accompanied by the HTTP header:

Content-Type: image/jpeg;

Some common examples:

Images

  • image/jpeg
  • image/png
  • image/gif
  • image/webp

Videos

  • video/mp4
  • video/mpeg

Application

  • application/javascript
  • application/json

Text

  • text/plain
  • text/html

Finished reading this article?
Our newsletter

No spam. Only free content, news, and ever more resources to level up your skills!

Join +1500 developers

Comments (0)

to leave a comment

No comments yet