HTTP Media Types
Media types (also called MIME types or content
types) identify the format of data transmitted
over HTTP. The Content-Type
header uses a media type to declare what the body
contains: text/html for an HTML page,
application/json for JSON data, image/png for
a PNG image. Clients and servers rely on the media
type to determine how to process the content.
IANA maintains the official registry of all registered media types. The registration procedures and naming rules are standardized.
Syntax
A media type consists of a top-level type and a subtype separated by a slash, with optional parameters after a semicolon:
type/subtype; parameter=value
Content-Type: text/html; charset=utf-8
Content-Type: multipart/form-data; boundary=---F
Content-Type: application/json
Type and subtype names are case-insensitive. Parameter names are case-insensitive, but parameter values follow their own rules defined per parameter.
Registration trees
Subtype names follow a tree convention indicating their registration status:
| Tree | Prefix | Purpose |
|---|---|---|
| Standards | (none) | Registered through IETF or standards bodies |
| Vendor | vnd. |
Publicly available products and formats |
| Personal | prs. |
Non-commercial, personal use |
| Unregistered | x. |
Private use only, discouraged |
The historical x- prefix (as in
application/x-www-form-urlencoded) predates
the formal tree system. New types no longer use
the x- prefix, though many legacy x- types
remain in widespread use.
Structured syntax suffixes
A +suffix at the end of a subtype indicates
the underlying data format, regardless of the
specific type semantics:
| Suffix | Format |
|---|---|
+json |
JSON |
+xml |
XML |
+zip |
ZIP archive |
+cbor |
CBOR |
+yaml |
YAML |
+gzip |
Gzip Compression |
+jwt |
JSON Web Token |
+sqlite3 |
SQLite database |
A parser for +json handles any type ending
in the suffix: application/ld+json,
application/vnd.api+json,
application/geo+json, and
application/problem+json are all valid JSON.
IANA maintains the Structured Syntax Suffix Registry.
Wildcards
The Accept header uses wildcards for content negotiation:
*/*: accepts any media typetype/*: accepts any subtype within a top-level type (e.g.,image/*)
Quality values rank preferences:
Accept: text/html, application/json;q=0.9, */*;q=0.1
Higher values indicate stronger preference. Specific types take precedence over wildcards at equal quality values.
text
Textual content readable as character data. The
charset parameter specifies the character
encoding. Modern practice defaults to UTF-8.
IANA registry: text/*
Web content
| Type | Description |
|---|---|
text/html |
HTML documents |
text/plain |
Unformatted text |
text/css |
CSS stylesheets |
text/javascript |
JavaScript source code |
text/xml |
XML documents |
text/markdown |
Markdown text (also used by CDN agent conversion) |
text/csv |
Comma-separated values |
Content-Type: text/html; charset=utf-8
The charset=utf-8 parameter declares the
character encoding. Servers serving HTML pages
include this parameter to prevent encoding
misinterpretation.
Markdown for AI agents
CDN providers convert HTML pages to Markdown
on the fly when clients send
Accept: text/markdown. The response carries
Content-Type: text/markdown; charset=utf-8
and an x-markdown-tokens header estimating
the token count. This reduces token
consumption by up to 80% compared to the
original HTML, making text/markdown a
practical format for LLM-based agents and
crawlers.
`text/javascript` is canonical
text/javascript is the sole media type
for JavaScript.
application/javascript,
application/ecmascript, and all other
JavaScript-related types are obsolete.
Data formats
| Type | Description |
|---|---|
text/calendar |
iCalendar data |
text/vcard |
vCard contacts |
text/tab-separated-values |
TSV files |
text/uri-list |
List of URIs |
text/event-stream |
Server-Sent Events |
text/vtt |
WebVTT subtitles/captions |
Linked data
| Type | Description |
|---|---|
text/turtle |
Turtle RDF syntax |
text/n3 |
Notation3 RDF syntax |
application
Data requiring application-specific processing. The largest category with over 1,500 registered subtypes covering APIs, documents, archives, and binary formats.
IANA registry: application/*
API and data interchange
| Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
application/json |
JSON data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
application/xml |
XML documents | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
application/yaml |
YAML data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
application/cbor |
CBOR binary data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
application/graphql-response+json |
GraphQL responses | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
application/problem+json |
linked-data-and-structured-data- search-engines-process-
-
visual-content.-the-subtype-identifies-the-specific-image-format. -iana-registry:- -modern-image-formats-like-webp,-avif,-and-jpeg-xl-offer-better-compression-than-png-and-jpeg-at-comparable-quality.-the-[[accept">Accept header enables content negotiation between formats:
Vector formats
SVG is XML-based and resolution-independent.
The Icons
The registered type is audioSound and music formats. The IANA registry: audio/*
The videoMoving pictures, typically with synchronized
audio. Like audio types, the IANA registry: video/*
The fontTypeface data for text rendering. The IANA registry: font/*
WOFF 2.0 ( CORS and fonts Browsers enforce same-origin policy for font loading. Cross-origin font files require CORS headers (Access-Control-Allow-Origin) on the font response. multipartComposite messages containing multiple body
parts, each with its own headers and media type.
A IANA registry: multipart/*
multipart/form-dataThe primary type for HTML form submissions with
file uploads. Each part has a
Content-Disposition:
The boundary string separates parts. The final
boundary ends with multipart/byterangesUsed in 206 Partial Content responses when the client requested multiple ranges:
Each part includes a Content-Range header identifying the byte range. model3D geometry, CAD data, and spatial representations. IANA registry: model/*
glTF ( messageEncapsulated messages, typically email or HTTP messages within a message body. IANA registry: message/*
tactile-feedback-data.-the-newest-top-level-type,-registered-as-a-standard-type. -iana-registry:- the-[[content-type">Content-Type header declares the media type of an HTTP message body. Servers set Content-Type on responses to tell clients how to interpret the content. Clients set Content-Type on requests containing a body (POST, PUT, PATCH) to tell the server what format the data is in. Server response
Client request
Content negotiationThe Accept request header lists the media types the client prefers. The server selects the best match and declares the chosen type in the Content-Type response header. Request
Response
The Vary header tells caches the response depends on the Accept header, ensuring cached responses match the requested format. MIME sniffingWhen a response lacks a Content-Type header or
the declared type conflicts with the actual
content, browsers perform MIME sniffing (content
inspection to guess the format). The
X-Content-Type-Options:
SEO and Content-Type Googlebot processes content based on the
Content-Type header. Serving HTML with an
incorrect Content-Type (like
TakeawayMedia types identify the format of every piece of content transmitted over HTTP. The Content-Type header declares the type, and the Accept header negotiates the preferred format. IANA maintains the official registry with over 2,000 registered types across eleven top-level categories: text, application, image, audio, video, font, multipart, model, message, haptics, and example. See also
Last updated: March 11, 2026
|