Dictionary

What Is MIME Type?

A MIME type is a short label, such as image/jpeg, that names the format of a file. Browsers and email programs use the label to handle the file, and metadata readers show it.

mime-type

A MIME type is a short label that names the format of a file, such as image/jpeg for a JPG photo. MIME stands for Multipurpose Internet Mail Extensions. The official name today is media type, so you often see both terms.

When you read the metadata of a file, the MIME type tells you which format the file has. Browsers and email programs use this label to decide how to open, show, or play the file.

What the value looks like

A MIME type has 2 parts, a type and a subtype, with a slash between them and no spaces. The type names the general kind of data, and the subtype names the exact format. In image/jpeg, the type is image and the subtype is jpeg.

The official IANA list of types has 11 entries: application, audio, example, font, haptics, image, message, model, multipart, text, and video. The example type is only for use in examples, so no formats are registered under it.

Upper case and lower case letters mean the same thing, but MIME types are usually written in lowercase. A parameter can follow after a semicolon. For example, text/plain;charset=UTF-8 marks a plain text file that uses the UTF-8 character set.

Typical values

Here are common formats and their MIME types on the web:

  • JPG photo: image/jpeg
  • PNG image: image/png
  • PDF document: application/pdf
  • MP3 audio: audio/mpeg
  • MP4 video: video/mp4
  • Plain text: text/plain
  • Word document (DOCX): application/vnd.openxmlformats-officedocument.wordprocessingml.document

The vnd. at the start of the Word subtype marks a vendor format, a format linked to a publicly available product. A suffix after a plus sign names the underlying format. image/svg+xml is built on XML, and application/epub+zip is a ZIP archive.

A JPG file can have one of several extensions, such as .jpg, .jpeg, or .jpe, but it has only one MIME type: image/jpeg. The official IANA list of media types has no entry named image/jpg.

Where the value comes from

MIME types began with email. The first MIME standard, RFC 1341, came out in June 1992. With MIME, email could carry other character sets, non-text content such as images, and messages in several parts.

Today RFC 2045, from November 1996, defines the Content-Type line that describes the content of a message. Websites send the same kind of label in the Content-Type header of each file. The Internet Assigned Numbers Authority (IANA) keeps the official list of media types.

To find the format, a program can look at the file name extension or at the first bytes of the file. An extension is only part of the file name, and nothing guarantees that it is correct. Many formats start with a fixed pattern of bytes, called a magic number, but not all of them do.

Which files carry it

A metadata report can show a MIME type for many kinds of file: a photo, a song, a video, or a document. ExifTool, a common metadata reader, lists the value as MIMEType in its File group. The same group holds the file type and the file type extension.

Some formats also carry a MIME type inside the file. An EPUB e-book must start with a small file named mimetype that holds application/epub+zip. In the ID3 tag of an MP3 file, an attached picture names its own format, such as image/jpeg or image/png.

Why it matters

Browsers use the MIME type, not the file extension, to decide how to handle a file from the web. With the wrong label, a page may not work, and a browser may handle a download the wrong way.

When a website does not recognize a file type, it usually sends application/octet-stream, which means unknown binary data. Browsers then offer to save the file instead of opening it.