Guide
MIME types and Content-Type: serving files so browsers handle them
Every file a web server sends carries a Content-Type header, and browsers decide what to do with it from that header, not from the file name. A wrong type makes a download open as text, a font refuse to load, a form reject an upload or a stylesheet get ignored. This lookup translates between file extensions and MIME types and gives the configuration lines to serve a type correctly.
What a MIME type is
A MIME type, today called a media type, has two parts separated by a slash: a top-level type such as text, image, audio, video, font, model or application, and a subtype such as png or json. Parameters can follow, most often charset=utf-8. The registry is maintained by IANA, and a few widely used types, such as application/x-tar, are unofficial but common.
Looking up in both directions
Type an extension like .webp or woff2, a whole file name like report.xlsx, or a type like application/json. Extensions return their type; a type returns every extension that uses it, so image/jpeg lists both jpg and jpeg. A wildcard such as video/* lists everything under that top-level type. If nothing matches, the page reminds you that unknown binary content is normally served as application/octet-stream, which tells browsers to download it.
Charset for text
Text-based types should say which character encoding they use, otherwise browsers guess. The generated header adds ; charset=utf-8 for types that are text underneath, including HTML, CSS, JavaScript, XML, SVG, CSV, YAML and TOML, and leaves it off for binary types such as images and fonts, where a charset would be meaningless.
Server configuration
For the first match, the page prints the header and the lines for the two most common servers. Nginx reads types from a types { … } block, usually in mime.types, so types { image/webp webp; } adds one. Apache uses AddType image/webp .webp in the configuration or .htaccess. If a new format downloads instead of displaying, a missing mapping is the usual cause, particularly for recent formats such as AVIF and WebP on older servers.
File inputs and the accept attribute
HTML upload fields filter files with the accept attribute, which takes MIME types and extensions together, for example accept="image/webp,.webp". Listing both is wise: some operating systems do not know a type for newer extensions. The page generates that attribute for the matched type.
A worked example
Choosing the .webp chip returns image/webp and produces Content-Type: image/webp, the Apache line AddType image/webp .webp, and an upload attribute naming the type and the extension. The video/* chip lists 10 matches in the built-in table, among them mp4, webm, mov and mkv. The “what does your browser say” box reports an empty type for a file whose extension the operating system does not know.
JavaScript, JSON and other special cases
JavaScript is text/javascript: RFC 9239 made it the standard in 2022 and declared application/javascript obsolete. JSON is application/json and needs no charset parameter because it is always UTF-8. SVG is image/svg+xml, and forgetting the +xml suffix stops it rendering in an image tag.
Limits
The table covers common web, office and developer formats, not the 1,000-plus registered types. Browsers decide File.type from the extension only, so it can be wrong or empty. For a file’s real format, check its first bytes, not its name.
Related tools
- HTTP Status Codes explains the responses that go with these headers.
- Nginx Config Generator writes the server block where types are set.
- Base64 Encoder builds data URLs that include a MIME type.
- HAR Analyzer shows the types a page actually received.
Checked against the current version of the MIME Type Lookup on .

