
Media type is a crucial aspect of how data is transmitted over the internet. It determines the type of data being sent, such as text, images, or videos.
Media types are used to identify the format of the data, ensuring it's delivered correctly to the recipient. This is achieved through a process called MIME (Multipurpose Internet Mail Extensions) encoding.
A media type consists of a type and a subtype, separated by a slash. For example, the media type for text is "text/plain". This helps devices and browsers understand the format of the data and display it accordingly.
Media types play a vital role in ensuring data is delivered correctly and efficiently. Without them, data could be misinterpreted or corrupted during transmission.
A fresh viewpoint: Internet Bottleneck
Terminology
The term "media type" can be a bit confusing, but it's used by the IANA and IETF. They consider the term "MIME type" to be outdated, but still used in certain contexts.
The IETF prefers the term "media type" because it's used in various internet standards, including HTTP. This is why you'll often see the term "media type" used in technical discussions about the internet.
The WHATWG, on the other hand, continues to use the term "MIME type" and advises against using "media type" due to potential ambiguity. This is because "media type" has a different meaning in the context of CSS's @media feature.
Here's a quick rundown of the terminology used by different organizations:
- IANA and IETF: "media type"
- WHATWG: "MIME type"
- W3C: "ContentType" (although this is an XML data-type name)
- Linux desktop environments: "MIME type" (via XDG specifications)
Definition
The term "media type" is widely used in internet standards, but its meaning can be ambiguous.
The IETF and IANA use the term "media type" and consider "MIME type" to be obsolete, since media types have become used in contexts unrelated to email, such as HTTP.
The WHATWG, however, continues to use the term "MIME type" and discourages the use of "media type" due to its ambiguity in relation to the CSS@media feature.
Some organizations, like the W3C, have used "ContentType" as an XML data-type name for a media type.
The term "MIME type" is still used in some specifications, such as those implemented by Linux desktop environments.
Here's a list of some of the terms and their meanings:
- MIME type: used by the WHATWG and some Linux specifications
- Media type: used by the IETF and IANA, but can be ambiguous
- ContentType: used by the W3C as an XML data-type name for a media type
Explanation
Terminology is a set of words and phrases used in a specific context or field. It's essential to understand the terminology used in a particular industry or profession to communicate effectively.
In the context of technical writing, terminology is used to convey complex ideas and concepts in a clear and concise manner. This is evident in the use of technical terms such as "acronym" and "abbreviation".
Terminology can also be used to establish a sense of professionalism and authority. For example, using industry-specific jargon in a business setting can make a company appear more credible.
A well-defined terminology helps to reduce confusion and miscommunication. By using standardized terms, individuals can quickly understand complex ideas and concepts.
Structure
A media type consists of a type and a subtype, which is further structured into a tree.
Types, subtypes, and parameter names are case-insensitive, making it easy to work with media types regardless of capitalization.
A media type can optionally define a suffix and parameters, which can provide additional details about the type of data it represents.
For example, an HTML file might be designated text/html; charset=UTF-8, where text is the type, html is the subtype, and charset=UTF-8 is an optional parameter indicating the character encoding.
MIME types, in particular, commonly consist of just two parts: a type and a subtype, separated by a slash (/) with no whitespace between.
The type represents the general category into which the data type falls, such as video or text, while the subtype identifies the exact kind of data of the specified type the MIME type represents.
For example, for the MIME type text, the subtype might be plain (plain text), html (HTML source code), or calendar (for iCalendar/.ics) files.
Each type has its own set of possible subtypes, and a MIME type always has both a type and a subtype, never just one or the other.
Optional parameters can be added to provide additional details, such as specifying the character set used for the characters in the data.
Check this out: Delta Lake Data Types
Common Media Types
Application/json is a common media type used for exchanging data in JSON format.
You'll often see it used in web APIs and server responses.
The IANA registry lists several other application media types, including application/ld+json (JSON-LD), application/msword (.doc), and application/pdf.
Here are some common media types:
- application/json
- application/ld+json
- application/msword (.doc)
- application/pdf
- application/sql
- application/vnd.api+json
- application/vnd.microsoft.portable-executable (.efi, .exe, .dll)
- application/vnd.ms-excel (.xls)
- application/vnd.ms-powerpoint (.ppt)
- application/vnd.oasis.opendocument.text (.odt)
- application/vnd.openxmlformats-officedocument.presentationml.presentation (.pptx)
- application/vnd.openxmlformats-officedocument.spreadsheetml.sheet (.xlsx)
- application/vnd.openxmlformats-officedocument.wordprocessingml.document (.docx)
- application/x-www-form-urlencoded
- application/xml
- application/zip
- application/zstd (.zst)
- audio/mpeg
- audio/ogg
- image/avif
- image/jpeg (.jpg, .jpeg, .jfif, .pjpeg, .pjp)
- image/png
- image/svg+xml (.svg)
- image/tiff (.tif)
- model/obj (.obj)
- multipart/form-data
- text/plain
- text/css
- text/csv
- text/html
- text/javascript(.js)
- text/xml
Data Storage
The mime.types file is crucial for associating filename extensions with a MIME type.
It's usually located at /etc/mime.types and/or $HOME/.mime.types in UNIX-type systems.
Each line in the mime.types file is a space-delimited list of a MIME type, followed by zero or more extensions.
For example, the HTML type can be associated with the extensions .htm and .html by the following line: text/html .htm .html.
This file is used by web servers to determine MIME type when MIME type information is not stored in the file system.
The mime.types file allows one to fall back on the extension when the MIME type is incorrectly set or set to a generic type such as application/octet-stream.
Additional reading: Onedrive Sort by File Type
Node and Application
Servers that don't recognize the .css suffix for CSS files may send them with text/plain or application/octet-stream MIME types.
If a server sends a CSS file with the wrong MIME type, like text/plain, most browsers will ignore it. The CSS mime type text/css must be used.
For a CSS file to be recognized by most browsers, it must be sent with the correct MIME type, text/css.
For another approach, see: Google Doc File Type
Legacy and Alternative Methods
Filename suffixes are sometimes used to convey document type information, especially on Microsoft Windows, but they're not always reliable due to varying operating system interpretations.
Not all operating systems consider these suffixes meaningful, and there's no guarantee they're correct.
Linux and macOS are examples of operating systems that don't consider filename suffixes meaningful.
Some file types have magic numbers, which can be used for file-type inference by looking at their byte structure, but not all file types have magic numbers.
For example, GIF files start with the 47 49 46 38 39 hexadecimal value (GIF89), and PNG files with 89 50 4E 47 (.PNG).
Here are some alternative methods of conveying document type information:
- Web media technologies
- Guide to media types used on the web
- Properly configuring server MIME types
Netscape Use
Netscape used a different format for the mime.types file, which employed key-value pairs and a comma-separated list of extensions.
This format included a standard header with a specific comment that identified the file as a mime.types file.
The comment used by Netscape consisted of a particular string that was unique to its format.
This approach was distinct from the format used by other systems, which is still widely used today.
Readers also liked: Html File Type
Legacy JavaScript
Legacy JavaScript is a thing of the past. There are multiple legacy JavaScript MIME types, including application/javascriptDeprecated, application/ecmascriptDeprecated, and application/x-ecmascriptNon-standard.
These legacy MIME types are still supported by some browsers, but they're not recommended for use. In fact, the MIME Sniffing Standard allows for any of these legacy types, but warns against using them.
You can see the full list of legacy MIME types here:
- application/javascriptDeprecated
- application/ecmascriptDeprecated
- application/x-ecmascriptNon-standard
- application/x-javascriptNon-standard
- text/ecmascriptDeprecated
- text/javascript1.0Non-standard
- text/javascript1.1Non-standard
- text/javascript1.2Non-standard
- text/javascript1.3Non-standard
- text/javascript1.4Non-standard
- text/javascript1.5Non-standard
- text/jscriptNon-standard
- text/livescriptNon-standard
- text/x-ecmascriptNon-standard
- text/x-javascriptNon-standard
The only MIME type you should use is text/javascript, as it's the only one guaranteed to work now and into the future.
Alternative Document Conveyance Methods

In the digital world, we often rely on MIME types to convey document type information. However, there are alternative methods to do so.
Filename suffixes are sometimes used, especially on Microsoft Windows, but not all operating systems consider these suffixes meaningful, and there is no guarantee they are correct.
You might have noticed that some files have a specific byte structure that can be used to infer their type. For example, GIF files start with the hexadecimal value 47 49 46 38 39 (GIF89), and PNG files with 89 50 4E 47 (.PNG).
Some file types don't have these magic numbers, so relying on them isn't 100% reliable either.
Here are some web media technologies, a guide to media types used on the web, and information on properly configuring server MIME types that can be helpful for those interested in learning more.
Content Type and Header
The Content-Type header is a crucial part of HTTP messages that contain an entity-body. It defines the media type of the body.
Some server configurations may use the associated MIME type to perform optimizations, such as file concatenation, compression, or caching. This is why it's essential to set the correct MIME type to ensure proper functionality.
Most web servers send unrecognized resources as the application/octet-stream MIME type, which can lead to security issues and limitations in user interactions. For example, most browsers do not allow setting a custom default action for such resources, forcing the user to save it to disk to use it.
A specific example is RAR-compressed files, where the ideal MIME type would be the true type of the original files. However, as .RAR files can hold several resources of different types, configuring the server to send application/x-rar-compressed is a more practical approach.
The RFC states that any HTTP/1.1 message containing an entity-body SHOULD include a Content-Type header field defining the media type of that body. If the media type is not given by a Content-Type field, the recipient MAY attempt to guess the media type via inspection of its content and/or the name extension(s) of the URI used to identify the resource.
Expand your knowledge: Content Type Html
Here are some common incorrect server configurations and their ideal MIME types:
- RAR-compressed files: application/x-rar-compressed
- Audio and video: specify the correct media type
- Proprietary file types: a specific type like application/vnd.mspowerpoint
Remember, guessing the media-type of a piece of data is called Content sniffing (or MIME-sniffing), and it's a practice that should be avoided. To explicitly tell browsers not to guess certain media types, the following header can be added.
Multiple and Part Media Types
Multiple media types can be specified to define the same data format for several types. This can be done by defining a custom object in the components section of your spec and referring to it in each media type.
You can also use placeholders like */*, application/*, image/*, or others to define the same format for multiple media types. For example, image/* is a common placeholder that means the same data structure will be used for all responses that match the placeholder.
Some common image types include image/apng, image/avif, image/gif, image/jpeg, image/png, image/svg+xml, and image/webp. These types are safe for use on web pages and can be used to specify the specific image file format represented.
Readers also liked: Golang Data Types
Here are some common image types:
The multipart/byteranges MIME type is used to send partial responses to the browser. This type indicates that the document is composed of several parts, one for each of the requested ranges.
Multiple
Multiple media types can be specified to use the same data format for several media types. This is done by defining a custom object in the components section of your spec and then referring to this object in each media type.
You can also use placeholders like */*, application/*, image/*, or others to define the same format for multiple media types. This is useful when you want to specify a range of media types.
The value you use as media type, such as image/*, is similar to what you see in the Accept or Content-Type headers of HTTP requests and responses. However, it's essential to note that the placeholder and the actual value of the Accept or Content-Type headers are not the same.
For example, using image/* as a placeholder means the server will use the same data structure for all responses that match the placeholder, not that the string image/* will be specified in the Content-Type header.
For your interest: Which of the following Is Not a Type of Printer?
Node 1 Multipart/Byteranges
The multipart/byteranges MIME type is used to send partial responses to the browser.
This type is triggered by the 206 Partial Content status code, which indicates that a document is composed of several parts, each representing a requested range.
Each piece of the document has a Content-Type header with its actual type and a Content-Range header that specifies the range it represents.
The Content-Type uses a boundary to separate the pieces, making it easy to distinguish between them.
The Content-Range header is crucial in multipart/byteranges, as it tells the browser which part of the document it's receiving.
For your interest: Linux Console Web Browser
Image and Other Media Types
Image and other media types are crucial for proper rendering and handling on the web. MIME types determine how these files are treated, and incorrect types can lead to security issues and user frustration.
Some common image types include image/apng, image/avif, image/gif, image/jpeg, image/png, image/svg+xml, and image/webp. These types are safe for use on web pages and can be found in the Image file type and format guide.
Server configurations may use MIME types to perform optimizations, such as file concatenation, compression, or caching. This is often seen in Apache configurations.
MIME types for audio and video files are also essential, as only resources with the correct type will be played in video or audio elements. A specific type like application/vnd.mspowerpoint lets users open such files automatically in the presentation software of their choice.
Here are some common MIME types for image and media files:
- image/apng: Animated Portable Network Graphics (APNG)
- image/avif: AV1 Image File Format (AVIF)
- image/gif: Graphics Interchange Format (GIF)
- image/jpeg: Joint Photographic Expert Group image (JPEG)
- image/png: Portable Network Graphics (PNG)
- image/svg+xml: Scalable Vector Graphics (SVG)
- image/webp: Web Picture format (WEBP)
- application/octet-stream: Unrecognized resources
- application/x-rar-compressed: RAR-compressed files
- application/vnd.mspowerpoint: Microsoft PowerPoint files
Names and Types
Setting the correct MIME type is crucial for security and usability reasons. It allows users to open files automatically in their preferred software.
Most web servers send unrecognized resources as the application/octet-stream MIME type. This can lead to security issues and usability problems.
Some common incorrect server configurations include sending RAR-compressed files as application/octet-stream. This is because .RAR files can hold several resources of different types.
A specific MIME type like application/vnd.mspowerpoint lets users open such files automatically in the presentation software of their choice.
You can use standard types or vendor-specific types (indicated by .vnd) for media types. For example, you can use standard types like audio/mpeg or video/mp4.
Here are some common MIME types for audio and video:
- audio/mpeg
- video/mp4
- application/vnd.mspowerpoint
Featured Images: pexels.com


