You're serving a JavaScript file and the browser refuses to execute it. Or you've built a file download endpoint and users are getting a browser window full of raw text instead of a download prompt. Or your API client is sending requests with the wrong Content-Type and the server is rejecting them. In every one of these cases, the problem is a MIME type.
MIME types are short, but they do a lot of work. Understanding them prevents a whole class of common web development bugs.
What MIME Stands For
MIME stands for Multipurpose Internet Mail Extensions. The name comes from email, where the format was originally designed to allow email messages to carry non-text attachments. The web adopted it as the standard way to label the type of content in any HTTP response, and it's been central to how browsers and servers communicate ever since.
The Format
Every MIME type follows the same pattern: type/subtype. The type is a broad category; the subtype is the specific format within that category.
text/html
text/css
text/javascript
application/json
application/pdf
image/png
image/svg+xml
audio/mpeg
video/mp4
multipart/form-data
An optional parameter can follow the subtype, separated by a semicolon. The most common is charset:
text/html; charset=utf-8
application/json; charset=utf-8
The Main Type Categories
The IANA (Internet Assigned Numbers Authority) maintains the official registry of MIME types. There are eight top-level type categories:
- text — human-readable content:
text/html,text/plain,text/css,text/csv - image — image formats:
image/jpeg,image/png,image/gif,image/webp,image/svg+xml - audio — audio formats:
audio/mpeg,audio/ogg,audio/wav - video — video formats:
video/mp4,video/webm,video/ogg - application — binary or structured data:
application/json,application/pdf,application/zip,application/octet-stream - multipart — content composed of multiple parts with different types:
multipart/form-data,multipart/mixed - font — font files:
font/woff,font/woff2,font/ttf - model — 3D model formats:
model/gltf+json
If you need to look up the correct MIME type for any file extension — or find which extensions correspond to a given MIME type — the MIME Type Lookup tool on DevToolShack covers the full IANA registry.
How MIME Types Flow Through HTTP
MIME types appear in two places in an HTTP exchange: the Content-Type header (on both requests and responses) and the Accept header (on requests).
When a browser requests a page, it sends an Accept header listing the content types it can handle, in preference order. When the server responds, it sets Content-Type to tell the browser what format the response body is in. The browser uses this to decide how to handle what it receives: render HTML, apply CSS, execute JavaScript, display an image, offer a download, and so on.
For a full breakdown of how these and other HTTP headers work together, see HTTP Headers Explained: What Every Developer Should Know.
Why Getting MIME Types Wrong Causes Problems
Scripts Blocked by the Browser
Modern browsers enforce strict MIME type checking for scripts. If your server sends a JavaScript file with Content-Type: text/plain instead of text/javascript (or the equivalent application/javascript), browsers with MIME sniffing blocked — which is most browsers with X-Content-Type-Options: nosniff set — will refuse to execute it. The file loads, but nothing runs, and you get a console error like "was blocked because of a disallowed MIME type."
Files Downloaded Instead of Displayed
If you serve an HTML file with Content-Type: application/octet-stream (the generic binary type), the browser will offer it as a download rather than rendering it. This is actually useful when you want to force a download regardless of file type, but it's a problem when it happens accidentally.
API Requests Rejected
When sending JSON to an API, the request must include Content-Type: application/json. Many server frameworks check this header before parsing the body. If you forget it or send the wrong type, the server may return a 400 or 415 (Unsupported Media Type) error. This is one of the most common mistakes when calling APIs with fetch() or tools like cURL. The cURL Generator sets the correct Content-Type automatically based on the request body type.
Image and Media Files Not Playing
Browsers rely on MIME types to choose the right decoder for audio and video. A .mp4 file served as application/octet-stream might not play in a <video> element even though the file itself is valid.
MIME Types in Form Submissions
HTML forms use MIME types to indicate how form data should be encoded when submitted. The enctype attribute on a <form> element controls this:
application/x-www-form-urlencoded— the default; key-value pairs encoded like a URL query stringmultipart/form-data— required for file uploads; each field is sent as a separate part with its own headerstext/plain— rarely used; sends data as plain text with no encoding
If you're submitting a form with a file input and the upload isn't working, check that enctype="multipart/form-data" is set on the form element. Without it, the file field is sent as just the filename string, not the file contents.
MIME Types for SVG
SVG deserves a special mention because it causes confusion. The correct MIME type for SVG is image/svg+xml. If your server sends SVG files as text/plain or application/octet-stream, the browser won't render them inline in <img> tags or as CSS backgrounds. For SVG optimization tips and a free browser-based SVG optimizer, see SVG Optimization: Why Your SVGs Are Too Big and How to Fix Them.
The application/octet-stream Fallback
application/octet-stream is the generic binary MIME type. It means "I don't know what this is; treat it as raw bytes." Browsers respond by offering the content as a download. This is the right choice when you're serving a file that should always be downloaded, regardless of what it contains. It's the wrong choice for anything you want the browser to render or execute.
mime.types or via AddType directives in .htaccess. In nginx, they're in the mime.types file included by default. Node/Express infers them from file extensions automatically when serving static files. The .htaccess Generator can produce the correct AddType directives for any MIME type you need to add.MIME Type Sniffing
When a server sends a response without a Content-Type header, or with an incorrect one, browsers try to guess the actual type by examining the content itself. This process is called MIME sniffing. Sniffing is a security risk because an attacker could upload a file that a server mislabels as an image but that contains HTML or JavaScript — and the browser's sniffing might execute it. The X-Content-Type-Options: nosniff response header turns off sniffing entirely, forcing the browser to trust only the declared Content-Type. This is one of the security headers covered in HTTP Headers Explained.
Looking Up MIME Types
The full list of registered MIME types is maintained by IANA and contains hundreds of entries. Rather than memorizing them, use the MIME Type Lookup tool to search by file extension or MIME type string. It covers every registered type and includes the common extensions for each.