Skip to content
BENIBIX Learn

File Extension vs MIME Type

People think the ending of a file name says what the file is, and it does not. The extension is a hint that your own computer reads to pick an app. On the web, the browser trusts the media type the server sends instead. When the two disagree, the browser goes with the server's label.

Development📄 Files & Formats

File Extension

The ending after the dot in a file name, like .pdf. It hints at what kind of file it is.

A file extension is the short ending on a file name, after the last dot. In report.pdf, the extension is .pdf. It hints at the file's format. Your computer uses it to pick which app opens the file. It is only a hint, though. The real format is in the bytes inside.

Example
Emma double-clicks budget.xlsx. Her computer sees .xlsx and opens it in her spreadsheet app.
Why it matters
Extensions decide which app opens a file. Some systems hide them, and that lets a fake file pass as a safe one.
Full entry
Development📄 Files & Formats

Media Type (MIME Type)

A label like image/png. It names the kind of data a server sends.

A MIME type is a short label that names the kind of data being sent. It has two parts with a slash, like text/html or image/png. Web servers send it with every file, in a header called Content-Type. The browser reads it to decide what to do. It may show a page, play a video or download a file. The list of official types is kept by IANA.

Example
A server sends Lucy a file marked as a PDF. Her browser opens it in its PDF viewer, not as raw bytes.
Why it matters
Browsers trust this label more than the file name. A wrong label can show code as text or download a page it should show.
Full entry

In one line

File Extension
The ending after the dot in a file name, like .pdf. It hints at what kind of file it is.
Media Type (MIME Type)
A label like image/png. It names the kind of data a server sends.