What Are MIME Types?
A MIME type (Multipurpose Internet Mail Extensions type), also called a media type, is a standardized label that tells software how to interpret the contents of a file or data stream. Every MIME type follows a two-part format: type/subtype. The type is a broad category such as text, image, application, or audio, while the subtype identifies the specific format, like html, png, or json.
When a web server responds to a request, it includes a Content-Type HTTP header that carries the MIME type of the response body. This header is how the browser decides whether to render HTML, parse JSON, display an image, or trigger a file download. Without it, browsers fall back to content sniffing, which is unreliable and can introduce security vulnerabilities.
The authoritative list of MIME types is maintained by the Internet Assigned Numbers Authority (IANA). Vendors can register their own subtypes using the vnd. prefix (for example, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet for .xlsx files), while unofficial types use the x- prefix.
Common MIME Types Developers Need
While hundreds of MIME types exist in the IANA registry, most web development work revolves around a handful of frequently used types:
application/json— the standard type for JSON payloads in REST APIs. Often paired with acharset=utf-8parameter.text/html— HTML documents. Browsers expect this type to render a page rather than download the file.text/cssandtext/javascript— stylesheets and scripts. Serving JavaScript with the wrong MIME type causes browsers to block execution.image/png,image/jpeg,image/webp,image/svg+xml— common image formats. Modern sites increasingly use WebP and AVIF for smaller file sizes.multipart/form-data— used by HTML forms that include file uploads. The browser splits the request body into parts separated by a generated boundary string.application/octet-stream— a generic binary type. Servers use it as a fallback when the exact format is unknown, which typically forces the browser to download the file instead of displaying it.application/pdf— PDF documents. Most modern browsers render PDFs inline rather than triggering a download.
MIME types can also include optional parameters. For example, text/html; charset=utf-8 tells the browser both the format and the character encoding. The boundary parameter in multipart/form-data is another common example that separates the individual parts of a multi-part request body.
Where MIME Types Matter
MIME types appear throughout the web stack, and getting them wrong leads to bugs that can be difficult to diagnose:
- HTTP response headers — the
Content-Typeheader on every response tells the client how to handle the body. A misconfigured web server that serves CSS files astext/plainwill cause styles to silently fail in strict mode. - File uploads — when users upload files through a form, the browser attaches a MIME type to each part. Server-side validation should check this type (along with the file signature) to prevent malicious uploads.
- Email attachments — MIME was originally designed for email. Each attachment in a multipart email message carries its own
Content-Typeso the email client knows how to render or offer the file for download. - Static file serving — web servers like Apache and Nginx map file extensions to MIME types using configuration files (
mime.typesor.htaccessdirectives). Adding a new file type to your project, like.wasmor.avif, may require updating this mapping. - Download dialogs — the
Content-Disposition: attachmentheader forces a download regardless of MIME type, but the MIME type still determines which application the OS suggests for opening the file after download.
Security headers like X-Content-Type-Options: nosniff tell the browser to trust the declared MIME type and never override it with content sniffing. This prevents attacks where a malicious file disguised with the wrong extension gets reinterpreted as executable HTML or JavaScript.
Related Tools
Working with MIME types often goes hand-in-hand with other HTTP and encoding tasks. Use the HTTP Status Codes reference to understand how servers communicate success, redirects, and errors alongside content types. The URL Parser helps you break down request URLs into their component parts, which is useful when debugging API endpoints that return unexpected content types. If you need to embed binary files directly in HTML or CSS, the Base64 Encoder converts file data into a text-safe format that you can use in data URIs like data:image/png;base64,... — where the MIME type is part of the URI itself.