Skip to main content

MIME Types Reference

Look up the correct Content-Type for any file extension — or go the other way. Runs entirely in your browser.

🔎

Quick Two-Way Lookup

Type a file extension (.pdf or pdf) to get its MIME type, or paste a MIME type (image/jpeg) to get the matching extensions. The direction is detected automatically.

Try:

Click any row to copy its MIME type. charset marks types that should carry ; charset=utf-8.

Extension MIME Type Description Category

How to Use This MIME Type Reference

  1. To find the MIME type for a file, type its extension into the Quick Two-Way Lookup box — with or without the leading dot.
  2. To find out which files a Content-Type header refers to, paste the MIME type instead. Any ; charset=… parameter is ignored.
  3. Use the search box below to filter the full table. It matches extension, MIME type and description at the same time, so "pdf", "spreadsheet" and "application/zip" all work.
  4. Narrow things down further with the category tabs — Image, Video, Audio, Text, Code, Document, Archive, Font or Application/Data.
  5. Click any row to copy its MIME type straight to your clipboard, ready to paste into your server config.

Everything runs in your browser. Nothing is uploaded, and the whole dataset is bundled with the page, so it keeps working offline.

What Is a MIME Type?

A MIME type — officially a media type — is a short label that tells a program what kind of data it is looking at. It always has the shape type/subtype: a top-level type such as text, image, audio, video, font, model, message, multipart or the catch-all application, followed by a specific subtype like png or pdf.

The name is a leftover from Multipurpose Internet Mail Extensions, the 1990s email standard where the concept was invented so that messages could carry images and attachments. The web borrowed it wholesale, and today the same registry of names is used by HTTP, email, and just about every file-handling API in between. IANA maintains the official list; anything starting with x- or vnd. is either unregistered or vendor-specific.

On the web the media type is delivered in the Content-Type response header, for example Content-Type: application/pdf. The same header appears on requests to describe the body you are sending — that is where application/json, application/x-www-form-urlencoded and multipart/form-data show up, none of which correspond to a file extension at all.

Why the Wrong Content-Type Breaks Things

Browsers trust the Content-Type header over the file extension in the URL. A file named report.pdf served as application/octet-stream will not open in the built-in PDF viewer — it drops straight into the downloads folder, because octet-stream literally means "unknown bytes, hand them to the user". The same mistake turns an inline image into a download prompt and an HTML page into a wall of visible source code.

The failures that eat the most debugging time are the ones where the browser refuses the resource outright:

  • ES modules. A <script type="module"> or a dynamic import() is rejected unless the response has a JavaScript MIME type. Serve a .mjs file as text/plain and the console says the module was blocked because of a disallowed MIME type — the file downloaded fine, it was just labelled wrong. This is the classic symptom of a static host that has no mapping for .mjs.
  • Stylesheets. A <link rel="stylesheet"> whose response is not text/css is ignored in standards mode. The page loads unstyled and the network tab shows a perfectly successful 200.
  • WebAssembly. WebAssembly.instantiateStreaming() requires application/wasm. Anything else falls over, which is why so many projects ship a manual ArrayBuffer fallback.
  • Fonts and media. A font served as application/octet-stream usually still works, but <video> and <audio> use the type to decide whether they can play a source at all, and a WebVTT track that is not text/vtt is silently dropped.
  • APIs. Send JSON without Content-Type: application/json and many frameworks will not parse the body, leaving you with an empty request object and a confusing 400.

The fix is almost always in the server, not the app: nginx reads mime.types, Apache reads mime.types plus AddType directives, and object stores such as S3 or R2 store the type as per-object metadata at upload time — which is why a file uploaded through the wrong tool keeps serving the wrong header until you re-upload or patch its metadata.

What charset=utf-8 Adds

A media type can carry parameters after a semicolon, and for textual formats the important one is charset: Content-Type: text/html; charset=utf-8. The media type says what the bytes are; the charset says how those bytes map to characters. Without it the browser has to guess, and a guess of Windows-1252 or ISO-8859-1 is what produces the familiar mojibake where é renders as é.

Modern browsers default to UTF-8 in many cases and HTML has the <meta charset="utf-8"> fallback, but the HTTP header wins over the meta tag and is the only signal available for formats that have no place to declare their own encoding — CSV downloads, plain text, subtitle files, JavaScript modules. Declaring it explicitly costs nothing and removes a whole class of intermittent bug.

Two exceptions worth remembering. JSON has no charset parameter at all: the spec fixes the encoding to UTF-8, so application/json; charset=utf-8 is redundant and technically undefined — plain application/json is correct. And binary types ignore it: adding a charset to image/png is meaningless. The rule of thumb is that text/* and the XML-based +xml types want a charset; almost nothing else does.

MIME Sniffing and X-Content-Type-Options: nosniff

Because so many servers were misconfigured, browsers historically second-guessed the header: if a response claimed text/plain but its first bytes looked like HTML, the browser would render it as HTML anyway. That behaviour is called MIME sniffing, and it is a security hole. If your site lets users upload a "text file" that actually contains <script> tags, a sniffing browser may execute it on your origin — a stored XSS delivered entirely through content sniffing.

Sending X-Content-Type-Options: nosniff switches that off. The browser takes the declared type at face value and, crucially, applies strict type checking to two categories: a script is blocked unless its type is a JavaScript MIME type, and a stylesheet is blocked unless it is text/css. Chrome extends this to Cross-Origin Read Blocking, refusing to hand cross-origin HTML, XML or JSON responses to an image or script tag.

The practical consequence: nosniff turns silent misconfiguration into a hard failure. Sites that "worked fine" before adding the header often break the moment it is enabled, which is a good thing — it surfaces the wrong Content-Type instead of papering over it. Send it on every response, and fix the types it exposes. Pair it with a correct Content-Disposition: attachment on user-uploaded files so they are downloaded rather than rendered on your origin at all.

Specifications

Accepts
No file needed
Gives you
copy to clipboard
Where it runs
Your browser — the file is never uploaded
Sign-up
None
Cost
Free, with no usage limits

FAQ

What is the MIME type for a PDF?

The correct MIME type for a PDF file is application/pdf. It has been the registered type since RFC 3778 and is understood by every browser PDF viewer. If your PDFs download instead of opening inline, the server is almost certainly sending application/octet-stream instead — or a Content-Disposition: attachment header is forcing the download.

Why is .js text/javascript and not application/javascript?

Both types work in browsers, but application/javascript was formally obsoleted by RFC 9239 in 2022. The HTML specification lists text/javascript as the canonical JavaScript media type and treats application/javascript, application/x-javascript and text/ecmascript as legacy aliases that browsers still accept for compatibility. New configuration should use text/javascript for .js, .mjs and .cjs alike.

What MIME type should I use for DOCX and XLSX?

The Office OpenXML formats have famously long types: a .docx is application/vnd.openxmlformats-officedocument.wordprocessingml.document and an .xlsx is application/vnd.openxmlformats-officedocument.spreadsheetml.sheet. They are not interchangeable with the legacy binary formats, which use application/msword and application/vnd.ms-excel. Sending the legacy type for a modern file is a common cause of Office refusing to open a download.

Can I trust the MIME type of an uploaded file?

No. On an upload the Content-Type comes from the client and is trivially forged, and the file extension is just part of a filename. Always validate server-side by inspecting the actual file contents — magic bytes or a real parser — and store the type you detected rather than the one you were told. Serving an uploaded file back with an attacker-chosen Content-Type is a well-known route to stored XSS.

Why does my browser download a file instead of displaying it?

Two headers control this. If Content-Type is application/octet-stream, or any type the browser has no renderer for, it downloads. If Content-Disposition is set to attachment, it downloads regardless of the type. Change the type to something the browser can render — application/pdf, image/png, text/plain — and use Content-Disposition: inline if you need to be explicit.

Is there an official list of MIME types?

Yes. IANA maintains the Media Types registry, which is the authoritative source. Anything with an x- prefix, such as application/x-7z-compressed, is an unregistered but widely used convention, and anything under vnd. is a vendor-specific registration. This page follows the registered names where they exist and flags the notable legacy aliases in the notes column.

Related Tools