A MIME type, also called a media type, tells browsers and servers what kind of file they are handling. It has a type and a subtype separated by a slash, such as image/png or application/json.
Web servers send it in the Content-Type header. A wrong value can stop scripts from running, show images as downloads, or block fonts from loading.
Tips for Serving Files
Most servers and CDNs set the type from the file extension automatically, but custom files may need manual configuration.
Add ; charset=utf-8 to text types such as text/html and text/css.
Use application/octet-stream to force a download for unknown binary data.
Send X-Content-Type-Options: nosniff so browsers trust the declared type.
Frequently Asked Questions
Should JavaScript use text/javascript or application/javascript?+
text/javascript is the current standard (RFC 9239). Browsers still accept the older application/javascript.
What MIME type should JSON APIs return?+
application/json. JSON exchanged between systems must be UTF-8, so a charset parameter is unnecessary.
Why do some types start with x-?+
The x- prefix marks types that were never officially registered with IANA. Many are still widely used, such as application/x-tar.