MIME Type Lookup
Find the correct Content-Type for a file extension, or the extensions that belong to a MIME type.
Everything you type here is processed on your own device. No input is sent to a server, logged, or stored.
What the MIME Type Lookup does
The MIME type lookup on this page will find the correct Content-Type for a file extension, or the extensions that belong to a MIME type. Paste your text in, pick the options you need, and copy the result straight back out. It is most often used for setting the Content-Type header for a file your server is sending. For a second version of this MIME type lookup, see FreeToolsWorld.org.
How to use it
- Type a file extension, with or without the dot.
- Or type part of a MIME type to find the extensions that use it.
- Copy the Content-Type value for your server configuration.
How it works
Getting the Content-Type wrong has consequences beyond the file not opening. A browser that receives text/plain for a stylesheet will refuse to apply it. One that receives the wrong type for a script may refuse to execute it under strict MIME checking. And serving a user-uploaded file with a type the browser will render, rather than download, is a stored cross-site scripting vector.
The charset parameter is not optional for text types in practice. Without it, browsers fall back to guessing, and a UTF-8 document interpreted as Latin-1 produces the familiar mojibake. Always send charset=utf-8 with text types.
SVG deserves specific caution. It is an XML document that may contain inline script, which executes when the file is rendered as a document. User-uploaded SVG served from your own origin with image/svg+xml is a scripting vulnerability; serve it from a separate origin or force a download.
X-Content-Type-Options: nosniff tells browsers to trust the declared type rather than inferring from content. It is a short header that closes a whole class of confusion attacks, and there is rarely a reason not to send it.
When to use it
- Setting the Content-Type header for a file your server is sending.
- Configuring MIME types in nginx, Apache or a CDN.
- Checking why a browser is downloading a file instead of displaying it.
- Finding the right type for an upload validation list.
Common mistakes to avoid
- Omitting charset=utf-8 on text types, which leaves browsers guessing.
- Serving user-uploaded SVG from your own origin, which can execute script.
- Using application/x-javascript, which is obsolete. The current type is text/javascript.
Frequently asked questions
What is the correct MIME type for JavaScript?
text/javascript, which the HTML specification designates as the correct type. application/javascript and application/x-javascript are obsolete.
Why does my CSS not apply?
Often because the server is sending the wrong Content-Type. Browsers in standards mode refuse to apply a stylesheet served as text/plain.
Is it safe to serve user-uploaded SVG?
Not from your own origin. SVG can contain executable script, so it needs to be served from a separate origin, sanitised, or sent with Content-Disposition: attachment.