# Media Type (MIME Type)

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

**Field:** Software Development  
**Category:** Files & Formats  
**Also known as:** MIME Type, Content Type, Internet Media Type

## Think of it like

Think of it like the label on a box. It says what is inside, so the right person opens it.

## Definition

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.

## Example code

```console
$ file --mime-type photo.png
photo.png: image/png
```

The file command reads the bytes and names the media type, image/png.

## 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.

## Common mistake

Sending a script with the wrong type. A browser can refuse to run a script that is labelled as plain text.

## Three principles

- **Two parts.** A kind and a subtype, joined by a slash.
- **Sent in a header.** Content-Type carries it on the web.
- **Beats the name.** Browsers trust the label, not the extension.

## Related terms

- [File Extension](https://learn.benibix.com/term/development/file-extension)
- [File Format](https://learn.benibix.com/term/development/file-format)
- [HTTP Header](https://learn.benibix.com/term/infrastructure/http-header)
- [Web Browser](https://learn.benibix.com/term/general/web-browser)
- [JavaScript Object Notation (JSON)](https://learn.benibix.com/term/development/json)

## Told apart from

- [File Extension vs MIME Type](https://learn.benibix.com/compare/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.

## Taught in

- [File Formats and Extensions](https://learn.benibix.com/learn/development-formats/file-formats-and-extensions): File Formats, 1/11

![Two panels. On the left, notes.txt, with .txt picked out, holds two readable lines, Buy milk and Call Jack at 5, and carries the label text/plain. On the right, photo.png, with .png picked out, holds rows of hex bytes starting 89 50 4E 47, and carries the label image/png. Notes under them say the ending after the dot is the file extension and the label is the media type a server sends.](https://learn.benibix.com/diagrams/dev2-file-types.svg)

---

Source: https://learn.benibix.com/term/development/mime-type
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-18
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
