Servers tell browsers what a file is with a MIME type, and getting one wrong makes downloads open incorrectly or scripts refuse to run. Type an extension, a file name or a type and this tool finds the match in either direction, then shows the exact Content-Type header to send.
How to use it
- Type an extension, file name or MIME type.
- Read the match.
- Copy the header value.
- Put it in your server or upload configuration.
When it helps
- Setting Content-Type on a server.
- Validating uploads.
- Fixing downloads that open the wrong way.
- Checking what type an extension maps to.
Good to know
- Text types usually need a charset, so the tool adds utf-8 where it applies.
- Unknown files are normally served as application/octet-stream.
- Don't rely on the extension alone for security; check the file's contents too.
What a MIME type is
A MIME type has a type and a subtype separated by a slash, like text/html or image/png. Servers send it in the Content-Type header, and browsers use it to decide how to handle a response: display it, run it, or offer it as a download.
Types such as application/json and text/csv are registered with a standards body, and vendor-specific ones start with vnd.
Worked example: a download problem
A PDF opens as text on your site. The server is probably sending text/plain or application/octet-stream. Look up pdf: the right type is application/pdf. Set it in your server configuration, and the browser will display the PDF.
Similarly, a JavaScript module may fail to load if the server sends text/html, because modern browsers check the type.
Security note
Browsers sometimes guess types when none is given, which has been exploited to run scripts disguised as images. Sending the correct type and the X-Content-Type-Options: nosniff header tells browsers not to guess.
When accepting uploads, check the file's real contents, not just its extension or the type the client claims.
Common types worth remembering
Web essentials: text/html, text/css, text/javascript, application/json, image/png, image/jpeg, image/webp, image/svg+xml, font/woff2 and application/pdf. For downloads of unknown files, application/octet-stream tells the browser to save rather than display.
Newer formats, such as AVIF images and WebAssembly, have their own types, image/avif and application/wasm.
Configuring servers
In Apache, use AddType; in Nginx, the types block in mime.types; in Express, res.type(). Modern hosts set most types automatically from the extension, so you only need to override unusual ones. After changes, clear caches and test with a browser's network panel.
Check the Content-Type header in the response, not just the file name.
Charsets and text types
For text responses, include a charset such as utf-8 in the header so browsers decode characters correctly. Without it, accented letters and symbols may show up wrongly.
Questions
What's the MIME type for JSON?
application/json.
Why is my file downloading instead of opening?
The server may be sending a generic or wrong type.