What Is a MIME Type?

What Is a MIME Type?

Every file sent over the web carries a label like text/html or image/png. That’s a MIME type — the internet’s file-extension system — and when it’s wrong, downloads break in confusing ways.

What it is

A MIME type is a two-part label: type/subtype.

  • text/html — a web page
  • image/png — a PNG image
  • application/pdf — a PDF document
  • application/json — JSON data

The browser uses it to decide how to handle the file: render it, download it, play it, or run it. The filename extension is a hint; the MIME type is the verdict.

Why MIME types matter in practice

  • Wrong type = wrong behavior: a PDF served as text/plain displays as garbage text instead of a document.
  • Security: browsers refuse to execute files served with misleading types — a script labeled image/png won’t run as a script.
  • APIs: a server that says application/json lets clients parse automatically; text/html makes them guess.

The daily encounters

  • Downloading a file and it saves as .html or .txt: the server sent the wrong MIME type. The file is fine — rename it and it opens correctly.
  • Uploading to a CMS that rejects your file: it’s usually checking the MIME type, not the extension.
  • Serving your own files: web servers map extensions to MIME types in a config table — add the mapping when you use an uncommon format.

The reference

The full mapping lives in the MIME types reference — hundreds of extensions and their types, searchable. When in doubt, look it up there rather than guessing.

One nuance worth knowing: MIME types were originally designed for email (the “M” is for Multipurpose). The web inherited them, and now they’re everywhere — which is why a thirty-year-old email convention decides whether your PDF opens correctly.