What is a MIME type?

A MIME type, also called a media type or content type, names the format of a file or a piece of data: text/html for a web page, image/png for a PNG picture, application/json for JSON data. It has two parts joined by a slash: the type, a broad group such as image or video, and the subtype, the exact format. Subtypes can be long, such as application/vnd.openxmlformats-officedocument.wordprocessingml.document for a Word document, and a suffix after + names the format underneath, as in image/svg+xml. Some types take parameters after a semicolon, such as text/html; charset=utf-8.

Web servers send the MIME type in the Content-Type header, so the browser knows whether to show a page, play a video or download a file. Email attachments carry one too. You check one when you set up a web server, write an API or list the file types an upload form accepts.

Tool description

Type or paste a type into the MIME type field, and the result shows as you type: "MIME type is valid" or "MIME type is not valid". Spaces and line breaks around a pasted type are ignored, and letter case doesn't matter: IMAGE/PNG passes. The page has no settings.

What passes

  • One of the types application, audio, font, image, message, model, multipart, text and video, then a slash and a subtype: audio/mpeg, font/woff2, model/gltf+json
  • Subtypes made of letters, digits, dots, hyphens, plus signs and underscores
  • A charset after text types, as in text/html; charset=utf-8, with or without the space after the semicolon and with or without quotes around the value
  • A boundary and a charset after multipart types: multipart/form-data; boundary=picnic

What fails

  • Any other type, even example, which the standard keeps for documentation
  • Wildcards such as image/* and */*, which Accept headers and upload forms use
  • Spaces around the slash or before the semicolon, and more than one space after it
  • Parameters after other types: application/json; charset=utf-8 fails, although many servers send it
  • Other parameters, such as text/plain; format=flowed or text/csv; header=present
  • Boundaries with characters other than letters, digits, dots, hyphens and plus signs (and spaces inside quotes), such as the underscores and equals signs some email programs put in them

Good to know

  • The check looks at the form, not at the official list of types: a made-up type such as image/banana passes.
  • To find out what a file really is, use the MIME Type Identifier, which reads the type from the file's first bytes.

Features

  • Checks the type, the subtype and the characters in them
  • Accepts charset and boundary parameters where they belong
  • Ignores letter case and spaces around the value
  • Results as you type, with no button to press
  • Runs in your browser, so nothing you type is sent anywhere