When this guide is useful
This is for users who want to check the list of MIME types, how to check Content-Type from the extension, the uses of application/json and image/webp, and the formats allowed for file uploads.
- Find out why Nginx, Apache, or CDN returns an incorrect Content-Type
- Check the media type of JSON, CSV, PDF, and images returned by the API
- Design file upload accept attributes and server-side validation
- Save
When to check the MIME type
- When checking the Content-Type settings of the web server or CDN
- When designing file upload permission formats
- When checking the media type of email attachments or API responses
- Isolating the cause of the mismatch between the extension and browser display/download behavior
Steps to find MIME type and extension
- Enter the extension, MIME type, or usage in the search field.
- Narrow down your search by category and registration status, and check candidate uses and typical extensions.
- Open details to see example HTTP headers, compressibility, character/binary handling, and safety precautions.
- Copy
- Check the actual response headers and file contents and test whether they are treated as intended.
Notes on not relying only on extensions
Since the file name extension and Content-Type can be changed by the user, upload verification does not rely only on the MIME type, but also checks the file signature, decoding capability, capacity, storage destination, and Content-Disposition at the time of delivery.
Displaying user-uploaded HTML or SVG from the same origin as is may lead to script execution. In addition to checking the format, consider sanitization and alternate origin distribution.
Specific example: Check the reason why WebP images are downloaded
If you open a WebP image URL and it is downloaded instead of displayed, the server may be returning something like application/octet-stream instead of image/webp.
Check the recommended MIME type by searching for .webp in the list, and check the actual Content-Type and Content-Disposition in the Network field of the developer tools.
- Enter .webp in the search field and open the image/webp details.
- Check the headers of the target response in your browser's developer tools.
- Modify the MIME mapping of your server or CDN to image/webp.
- Refresh the cache and recheck image display and download behavior.
Even if you modify the Content-Type, the old CDN cache may remain. Please also check the Age and cache key of the response.
Frequently asked questions
- If the extensions are the same, will the MIME type be determined as one?
- Additional information: IANA
- Can you determine whether a file is safe just by its MIME type?
- Save
在浏览器中试用
输入内容仅在浏览器中处理。请保留原始数据,确认结果无误后再保存或分享。
Open MIME type list/extension search tool