MIME (Multipurpose Internet Mail Extensions) type is a standardized way of describing the format of a file. It is used in web browsers, email clients, and servers to understand how to process or display the data they receive.
A MIME type has two parts, separated by a forward slash (/
):
text
, image
, or application
.html
, jpeg
, or json
.For example:
text/html
: Represents an HTML document.image/jpeg
: Represents a JPEG image.application/json
: Represents JSON data.MIME types are important for the following reasons:
MIME Type | Description | Example File Extensions |
---|---|---|
text/plain | Plain text file | .txt |
text/html | HTML document | .html, .htm |
image/jpeg | JPEG image | .jpg, .jpeg |
application/json | JSON data | .json |
application/pdf | PDF document |
When a server sends a file to a browser, it includes a Content-Type header in the HTTP response. This header specifies the MIME type of the file, helping the browser understand how to process the content.
Content-Type: text/html