What is a MIME type?
Short answer
A MIME type (or media type) is a label like text/html or image/png that tells software the format of a file or response. It has a type and subtype separated by a slash, and browsers use it to decide how to handle content.
What a MIME type does
A MIME type (now officially a media type) identifies a file's format so software knows how to process it. On the web, servers send it in the Content-Type header, and the browser decides whether to render, play, or download the content. See what is an HTTP header.
How they are structured
text/html; charset=utf-8
| | |
type subtype parametertext/html— a web pageapplication/json— a JSON payloadimage/png— a PNG imageapplication/pdf— a PDF documentapplication/octet-stream— unknown binary, usually downloaded
X-Content-Type-Options: nosniff make the declared type authoritative.Where MIME types appear
- The HTTP
Content-TypeandAcceptheaders - Email attachments (MIME began with email)
- HTML
<input accept>and<source type>attributes - File upload validation