MIME Type Lookup — File Extension ↔ Content-Type
Get the official MIME type for any file extension — or the extension for any media type — straight from the IANA registry, with copy-ready Content-Type headers. Covers 121 common web, office, and media extensions. No signup, sources cited.
How it works
This is a reference tool, not a calculator — so the “method” is the data model and the rules behind it, every record sourced. A single typed module holds 85 curated types covering 121 extensions, each record carrying its canonical type/subtype string, the extensions that map to it, a category, whether it is IANA-registered, and a sourced note where the standard and real-world server behaviour differ.
- Normalise. The query is trimmed and lowercased. For an extension a leading
*.glob or a single dot is stripped, so .PNG, png, and *.png all resolve the same. - Detect direction. If the query matches the RFC 6838 type/subtype grammar (it contains a / and valid characters) the tool does a reverse lookup (MIME → extension); otherwise a forward lookup (extension → MIME). Parameters after a ; are dropped, so text/html; charset=utf-8 matches text/html.
- Forward. The extension indexes directly to its entry. Each extension is claimed by exactly one record, so the answer is unambiguous; where two types historically compete (e.g. .ico), the table records the IANA-registered string and notes the de-facto alternative — the preference order IANA-first, then Apache.
- Reverse. The media type matches its canonical string or any recognised alias — application/javascript resolves to the .js entry whose canonical type is text/javascript, per WHATWG.
- Fallback. A miss returns
application/octet-stream— the generic binary type browsers fall back to for unknown content (WHATWG MIME Sniffing) — plus the closest fuzzy matches.
The registration label comes from the subtype prefix (RFC 6838): no prefix is the standards tree, vnd. is the vendor tree (the Office and OpenDocument types), and x-marks an unregistered de-facto type. A self-check function verifies that every record's top-level type equals its category, that every string matches the type/subtype grammar, and that no extension is claimed twice — the lookup's version of a cross-formula check.
Worked examples
Frequently asked questions
Sources & references
- IANA — Media Types registry (the canonical type/subtype strings)
- WHATWG — MIME Sniffing Standard (web behaviour & octet-stream fallback)
- Apache HTTP Server — conf/mime.types (de-facto extension mapping)
- RFC 6838 — Media Type Specifications and Registration Procedures
Type strings follow the IANA registry verbatim; the IANA/de-facto labels follow RFC 6838's registration trees. The bundled table was last cross-checked against the IANA registry and Apache mime.types on 2026-06-27.
Related tools
Comments & feedback
Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.
Found a wrong type, a missing extension, or an edge case?
Email me at [email protected] — most fixes ship within 24 hours.