MIME Types: Complete Developer Reference
Look up MIME types for any file extension — with content-type headers and browser behavior explained.
Published:
Tags: MIME types reference, content-type mime type, file type header
MIME Types: Complete Developer Reference MIME types tell HTTP clients how to interpret response data. Getting them wrong causes browsers to misrender content, refuse downloads, or execute scripts in unexpected contexts. This reference covers the most common MIME types, how they appear in HTTP headers, and what happens when they're set incorrectly. --- All the tools discussed here are available for free at theproductguy.in — client-side, no sign-up required. Part of the HTTP Debugging Tools Guide — a complete toolkit for diagnosing web requests. --- What about MIME Type Structure? A MIME type has two parts separated by a slash: With an optional parameter: The type is one of a small set of top-level categories: | Type | Description | |------|-------------| | | Human-readable text | | |…
Frequently Asked Questions
What is a MIME type?
A MIME type (Multipurpose Internet Mail Extensions type) is a two-part identifier for file formats and content types transmitted over the internet. It consists of a type and subtype separated by a slash, such as text/html or application/json. HTTP uses MIME types in the Content-Type header to tell clients how to handle response data.
What is the MIME type for JSON?
The standard MIME type for JSON data is application/json. Always set this in the Content-Type header when returning JSON from an API: Content-Type: application/json; charset=utf-8. Some older APIs incorrectly use text/plain or text/javascript for JSON responses, which can cause browser parsing issues.
What is the difference between text/plain and text/html?
text/plain tells the browser to render the content as raw text, escaping all HTML tags. text/html tells the browser to parse and render the content as a full HTML document. Serving user-generated content with text/html instead of text/plain can enable XSS attacks if the content isn't sanitized.
How do I set content-type in an API response?
In Express.js, use res.json() which automatically sets Content-Type: application/json, or res.setHeader('Content-Type', 'application/json'). In Python FastAPI/Flask, set the media_type parameter. In raw HTTP responses, add the header before the blank line that separates headers from body.
What is multipart/form-data?
multipart/form-data is the MIME type used for HTML form submissions that include file uploads. Each field in the form becomes a separate 'part' separated by a boundary string. The browser generates the boundary automatically — you should never set Content-Type manually on a fetch request using FormData, or the boundary will be missing.
All articles · theproductguy.in