MIME Types Cheat Sheet
Quickly find common MIME types, understand when to use them and learn best practices for setting Content-Type headers correctly.
MIME types, also known as media types, identify the format of data transmitted over HTTP. They are used by the Content-Type header to tell browsers, APIs and other clients how a request or response body should be interpreted. Using the correct MIME type is essential for compatibility, security and predictable application behavior.
This cheat sheet collects the MIME types developers encounter most frequently when building websites, REST APIs, file upload systems and web applications. Instead of memorizing every value, you can use this guide as a quick reference whenever you need the correct Content-Type.
What Is a MIME Type?
A MIME type is a standardized identifier consisting of a type and subtype separated by a slash. For example, application/json identifies JSON data, while image/png identifies PNG images.
type/subtypeMost Common MIME Types
| MIME Type | Typical Usage |
|---|---|
| text/html | HTML pages |
| text/plain | Plain text |
| text/css | CSS stylesheets |
| application/json | REST APIs |
| application/xml | XML documents |
| application/pdf | PDF files |
| application/javascript | JavaScript files |
Image MIME Types
| Format | MIME Type |
|---|---|
| PNG | image/png |
| JPEG | image/jpeg |
| GIF | image/gif |
| SVG | image/svg+xml |
| WebP | image/webp |
| AVIF | image/avif |
| ICO | image/x-icon |
Audio MIME Types
| Format | MIME Type |
|---|---|
| MP3 | audio/mpeg |
| WAV | audio/wav |
| OGG | audio/ogg |
| AAC | audio/aac |
| WebM Audio | audio/webm |
Video MIME Types
| Format | MIME Type |
|---|---|
| MP4 | video/mp4 |
| WebM | video/webm |
| OGG | video/ogg |
| AVI | video/x-msvideo |
| MPEG | video/mpeg |
Document MIME Types
| Document | MIME Type |
|---|---|
| application/pdf | |
| DOCX | application/vnd.openxmlformats-officedocument.wordprocessingml.document |
| XLSX | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet |
| PPTX | application/vnd.openxmlformats-officedocument.presentationml.presentation |
| CSV | text/csv |
| RTF | application/rtf |
Archive MIME Types
| Archive Format | MIME Type |
|---|---|
| ZIP | application/zip |
| RAR | application/vnd.rar |
| 7Z | application/x-7z-compressed |
| TAR | application/x-tar |
| GZIP | application/gzip |
Font MIME Types
Modern websites commonly load custom fonts through CSS. Returning the correct MIME type helps browsers recognize and cache font files efficiently.
| Font Format | MIME Type |
|---|---|
| WOFF | font/woff |
| WOFF2 | font/woff2 |
| TTF | font/ttf |
| OTF | font/otf |
Form Submission MIME Types
HTML forms submit data using different Content-Type values depending on how the form is configured. File uploads require multipart/form-data, while standard forms often use application/x-www-form-urlencoded.
| Form Type | Content-Type |
|---|---|
| Standard HTML form | application/x-www-form-urlencoded |
| File upload | multipart/form-data |
| JavaScript JSON request | application/json |
API MIME Types
Modern APIs primarily exchange structured data. JSON has become the dominant format, although XML is still widely used by legacy systems and enterprise integrations.
| API Format | MIME Type |
|---|---|
| JSON | application/json |
| JSON-LD | application/ld+json |
| XML | application/xml |
| SOAP XML | text/xml |
Text MIME Types
| Content | MIME Type |
|---|---|
| Plain text | text/plain |
| HTML | text/html |
| CSS | text/css |
| CSV | text/csv |
| Markdown | text/markdown |
| Calendar | text/calendar |
Binary MIME Types
Some files do not have a specific standardized MIME type or represent arbitrary binary data. In these situations, servers commonly return application/octet-stream, which tells browsers that the content should generally be treated as a downloadable binary file.
Content-Type: application/octet-streamChoosing the Correct MIME Type
Selecting the correct MIME type depends on the actual content rather than the file extension alone. Servers should identify the real format of the resource and return the matching Content-Type value to ensure browsers and applications process it correctly.
| Scenario | Recommended MIME Type |
|---|---|
| REST API response | application/json |
| Website homepage | text/html |
| CSS stylesheet | text/css |
| SVG icon | image/svg+xml |
| File download | application/octet-stream (when appropriate) |
Common MIME Type Mistakes
- Serving JSON as text/plain.
- Returning HTML with application/json.
- Using outdated JavaScript MIME types.
- Serving SVG as text/plain instead of image/svg+xml.
- Assuming browsers will always guess the correct content type.
- Configuring servers based only on file extensions without verification.
MIME Types and HTTP Headers
MIME types are most commonly used with the HTTP Content-Type header. When a client sends data to a server or receives a response, the Content-Type header specifies which MIME type describes the message body. This allows browsers, APIs and other applications to process the content correctly.
MIME Types and Security
Accurate MIME types improve security by reducing ambiguity. Browsers rely on the declared media type when deciding how to handle content, and incorrect values may lead to rendering issues or MIME sniffing. Many web servers also send the X-Content-Type-Options: nosniff header to instruct browsers not to guess the content type.
How Web Servers Determine MIME Types
Most web servers automatically assign MIME types based on configured mappings between file extensions and media types. Dynamic applications often set the Content-Type header programmatically before sending a response, allowing APIs and generated content to specify the correct media type regardless of file names.
Frequently Used Developer MIME Types
| Technology | Common MIME Type |
|---|---|
| JSON API | application/json |
| HTML | text/html |
| CSS | text/css |
| JavaScript | application/javascript |
| SVG | image/svg+xml |
| Web App Manifest | application/manifest+json |
| WebAssembly | application/wasm |
Best Practices
- Always return the official MIME type for every resource.
- Use application/json for REST API payloads.
- Serve SVG files as image/svg+xml.
- Verify server MIME mappings after deployment.
- Use UTF-8 for modern text-based content where appropriate.
- Enable X-Content-Type-Options: nosniff for improved browser security.
Frequently Asked Questions
What is a MIME type?
A MIME type is a standardized identifier that describes the format of transmitted data. It is commonly used in the HTTP Content-Type header so browsers and applications know how to process a resource.
What MIME type should JSON use?
JSON should be served using application/json, which is the standard media type for JSON documents and REST API payloads.
What MIME type should HTML pages use?
HTML documents should be served as text/html, typically with a UTF-8 character encoding parameter when appropriate.
What happens if the wrong MIME type is used?
Browsers or applications may render content incorrectly, refuse to process it, download it unexpectedly or trigger security protections such as MIME type validation.
Are MIME types only used by web browsers?
No. MIME types are used by browsers, APIs, web servers, email systems, file upload services and many other applications that exchange structured data.
Helpful HTTP Tools
A MIME Type Lookup helps you quickly find the correct media type for a file format, a MIME Type Detector identifies likely MIME types from uploaded content, a Content-Type Finder assists in selecting appropriate HTTP Content-Type values, an HTTP Header Viewer lets you inspect response headers returned by servers, and an HTTP Response Formatter makes API responses easier to read while verifying Content-Type information.
Conclusion
MIME types are a fundamental part of HTTP communication, allowing clients and servers to identify the format of transmitted data consistently. Whether you're serving web pages, building REST APIs, delivering images or handling file downloads, using the correct Content-Type ensures resources are interpreted correctly, improves interoperability and helps avoid compatibility and security issues. Keeping a practical MIME type cheat sheet nearby makes configuring web servers and debugging HTTP responses significantly easier.