Developer & Tech

MIME Type Lookup

What this does

Look up the Content-Type MIME type for a file extension, with an honest fallback for extensions without a standard mapping.

Enter your details

Runs in your browser

Calculator inputs

With or without the leading dot.

Using the mime type lookup

  1. 01

    Type the extension

    pdf, PNG, .jpg; case and the dot do not matter.

  2. 02

    Copy the header

    Use the suggested Content-Type row directly in your server config or upload handler.

Why MIME types matter

Browsers decide whether to render, play, execute or download a response based almost entirely on its Content-Type header. A wrong type breaks image previews, triggers download prompts, or worse; lets an uploaded file be interpreted as HTML, opening XSS holes.

The octet-stream fallback

application/octet-stream means “opaque bytes”: browsers will download rather than display. It is the correct honest answer for anything unrecognized, and safer than guessing a renderable type.

The math behind this calculator

extension → static MIME map (IANA media types)

The extension is trimmed of any leading dot, lowercased and matched against a curated map of roughly forty common media types. Unknown extensions return application/octet-stream with an explicit note instead of pretending to know.

Assumptions & limitations

  • Curated common-type table, not the full IANA registry.
  • Some formats legitimately carry multiple MIME types (e.g. js).
  • Servers may add charset parameters separately.

Worked example

A .pdf file should ship with Content-Type: application/pdf so browsers render it with their built-in viewer instead of downloading it.

Frequently asked questions

Is it js or application/javascript?
Both appeared historically; current guidance favors text/javascript and modern browsers accept it universally.
Do I need charset=utf-8 too?
For text/* responses, yes; append it (e.g. text/html; charset=utf-8) so browsers decode correctly.
Where is the authoritative list?
The IANA media types registry at iana.org/assignments/media-types; our table covers the everyday subset.

Related calculators