MIME Type Lookup content-type
Find the MIME type for a file extension, or the extensions associated with a MIME type.
What this tool does
A MIME type is a standard string describing a data format, written as type/subtype, such as text/html, application/json, or image/png. On the web it travels in the HTTP Content-Type header, and browsers use it to decide how to handle what they receive.
Getting Content-Type wrong causes a range of problems. A JSON response labelled text/plain may not be parsed by client libraries, an image with the wrong type will not display, and a file meant to be downloaded may open inline instead, or the reverse.
MIME types matter for uploads too, although the type reported by the client can be forged, so the server must inspect the actual file contents.
When to use it
Use it when setting the Content-Type header for a download response, when defining a list of accepted upload formats, when adding a type mapping to web server configuration, or when investigating why a file returned by an API is handled incorrectly by browsers.
Input and output examples
json
application/json
The most common type in API responses.
pdf
application/pdf
Whether it opens inline or downloads is controlled by the Content-Disposition header.
image/svg+xml
svg
SVG is XML based, hence the +xml suffix on the subtype.
Notes and limitations
Checking the MIME type of an upload is not a security control. The Content-Type sent by a client is arbitrary, so an executable can be presented as an image. Servers should verify the real file signature and prevent script execution in upload directories. Note also that some formats have more than one type in circulation; JavaScript has been served as both text/javascript and application/javascript, with text/javascript now standard.
Frequently asked questions
My file downloads instead of opening.
The Content-Type is probably application/octet-stream, or Content-Disposition is set to attachment. Check the server configuration.
Can MIME checks secure uploads?
Not on their own, because the client value can be forged. Inspect the file contents server-side and restrict execution in the upload directory.