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 type
  • type/*: 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----type-description----application/ld+json-json-ld-linked-data---application/schema+json-json-schema---application/vnd.api+json-json:api-format---application/hal+json-hal-hypermedia---application/geo+json-geojson---application/atom+xml-atom-feeds--
--seo-and-structured-data

-

search-engines-process-application/ld+json-blocks-embedded-in-html-pages-as-schema.org-structured-data.-json-ld-is-the-format-google-recommends-for-structured-data-markup.

--forms-and-binary-data----type-description----application/x-www-form-urlencoded-url-encoded-form-data---application/octet-stream-generic-binary-data--
-

application/x-www-form-urlencoded-is-the-default-encoding-for-html-<form>-submissions.-key-value-pairs-are-separated-by-&,-with-special-characters-percent-encoded-and-spaces-encoded-as-+:

-
content-type:-application/x-www-form-urlencoded-username=jane&password=s%40fe%21-
-

application/octet-stream-is-the-fallback-for-unknown-binary-data.-browsers-typically-trigger-a-download-when-receiving-this-type.

-documents----type-description----application/pdf-pdf-documents---application/zip-zip-archives---application/gzip-gzip-compressed-data---application/epub+zip-epub-e-books---application/wasm-webassembly-modules---application/xhtml+xml-xhtml-documents---application/manifest+json-web-app-manifest---application/csp-report-csp-violation-reports--
-microsoft-office-(ooxml)----type-format----application/vnd.openxmlformats-officedocument.wordprocessingml.document-.docx---application/vnd.openxmlformats-officedocument.spreadsheetml.sheet-.xlsx---application/vnd.openxmlformats-officedocument.presentationml.presentation-.pptx--
-opendocument----type-format----application/vnd.oasis.opendocument.text-.odt---application/vnd.oasis.opendocument.spreadsheet-.ods---application/vnd.oasis.opendocument.presentation-.odp--
-security-and-tokens----type-description----application/jwt-json-web-token---application/jose+json-jose-json---application/pkcs7-mime-s/mime-encrypted-data---application/pkix-cert-x.509-certificate--
-legacy-microsoft-office----type-format----application/vnd.ms-excel-.xls---application/vnd.ms-powerpoint-.ppt---application/msword-.doc--
-image-

visual-content.-the-subtype-identifies-the-specific-image-format.

-

iana-registry:-image/*

-raster-formats----type-description----image/png-png,-lossless,-alpha-transparency---image/jpeg-jpeg,-lossy,-photographs---image/gif-gif,-256-colors,-animation---image/webp-webp,-lossy/lossless,-alpha,-animation---image/avif-avif,-av1-codec,-hdr,-wide-color-gamut---image/jxl-jpeg-xl,-progressive,-lossless/lossy---image/bmp-bmp,-uncompressed-bitmap---image/tiff-tiff,-print/publishing---image/apng-animated-png---image/heic-heic,-heif-with-hevc-codec--
-
content-type:-image/webp-
-

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:

Accept: image/avif, image/webp, image/png, */*;q=0.8

Vector formats

Type Description
image/svg+xml SVG vector graphics

SVG is XML-based and resolution-independent. The +xml suffix indicates the underlying format.

Icons

Type Description
image/vnd.microsoft.icon ICO format (favicons)

The registered type is image/vnd.microsoft.icon, though image/x-icon is commonly used in practice.

audio

Sound and music formats. The codecs parameter specifies the codec when the container format supports multiple codecs.

IANA registry: audio/*

Type Description
audio/mpeg MP3 audio
audio/aac AAC (Advanced Audio Coding)
audio/ogg Ogg container, Vorbis or Opus
audio/opus Opus codec
audio/flac FLAC lossless
audio/wav WAV uncompressed audio
audio/webm WebM audio container
audio/mp4 MP4 audio container
audio/midi MIDI sequence data
audio/matroska Matroska audio
Content-Type: audio/mp4; codecs="mp4a.40.2"

The codecs parameter identifies the specific codec within the container. mp4a.40.2 is AAC-LC (Low Complexity).

video

Moving pictures, typically with synchronized audio. Like audio types, the codecs parameter identifies specific codecs within container formats.

IANA registry: video/*

Type Description
video/mp4 MP4 container
video/webm WebM container, VP8/VP9/AV1
video/ogg Ogg container, Theora
video/mpeg MPEG-1/MPEG-2 video
video/quicktime QuickTime container (.mov)
video/matroska Matroska container (.mkv)
video/H264 H.264/AVC
video/H265 H.265/HEVC
video/AV1 AV1 codec
Content-Type: video/mp4; codecs="avc1.42E01E, mp4a.40.2"

The codecs parameter lists both the video codec (avc1.42E01E, H.264 Baseline Profile, Level 3.0) and the audio codec (mp4a.40.2, AAC-LC). Browsers use this information to determine playback support without downloading the file.

font

Typeface data for text rendering. The font top-level type replaced earlier registrations under application/*.

IANA registry: font/*

Type Description
font/woff2 WOFF 2.0, Brotli compressed
font/woff WOFF 1.0, compressed SFNT
font/ttf TrueType
font/otf OpenType
font/sfnt Generic SFNT container
font/collection Font collection (.ttc)
Content-Type: font/woff2

WOFF 2.0 (font/woff2) uses Brotli compression and is the most efficient web font format. The legacy types application/font-woff, application/x-font-ttf, and application/vnd.ms-opentype are superseded by the font/* types.

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.

multipart

Composite messages containing multiple body parts, each with its own headers and media type. A boundary parameter (required) delimits the parts.

IANA registry: multipart/*

Type Description
multipart/form-data Form data with file uploads
multipart/byteranges HTTP range responses
multipart/mixed Independent parts in sequence
multipart/alternative Same content in different formats
multipart/related Parts referencing each other
multipart/signed Content with digital signature
multipart/encrypted Encrypted content

multipart/form-data

The primary type for HTML form submissions with file uploads. Each part has a Content-Disposition: form-data header with the field name:

Content-Type: multipart/form-data; boundary=----FormBoundary

------FormBoundary
Content-Disposition: form-data; name="title"

Quarterly Report
------FormBoundary
Content-Disposition: form-data; name="file"; filename="report.pdf"
Content-Type: application/pdf

(binary PDF data)
------FormBoundary--

The boundary string separates parts. The final boundary ends with --.

multipart/byteranges

Used in 206 Partial Content responses when the client requested multiple ranges:

Content-Type: multipart/byteranges; boundary=RANGE

--RANGE
Content-Type: text/plain
Content-Range: bytes 0-9/100

First part
--RANGE
Content-Type: text/plain
Content-Range: bytes 90-99/100

Last part.
--RANGE--

Each part includes a Content-Range header identifying the byte range.

model

3D geometry, CAD data, and spatial representations.

IANA registry: model/*

Type Description
model/gltf+json glTF 2.0 JSON (Khronos)
model/gltf-binary glTF 2.0 binary (.glb)
model/stl STL, 3D printing
model/obj Wavefront OBJ
model/step STEP CAD exchange
model/3mf 3D Manufacturing Format
model/vnd.usdz+zip USDZ (Apple/Pixar)

glTF (model/gltf+json and model/gltf-binary) is the primary 3D format for web applications, supported by WebGL and WebGPU renderers.

message

Encapsulated messages, typically email or HTTP messages within a message body.

IANA registry: message/*

-oblivious-http-response---message/bhttp-binary-http-message--
Type Description
message/rfc822 Email message
message/http HTTP message
message/partial Fragment of a larger message
message/global Internationalized email
message/ohttp-req message/ohttp-res
-haptics-

tactile-feedback-data.-the-newest-top-level-type,-registered-as-a-standard-type.

-

iana-registry:-haptics/*

----type-description----haptics/ivs-vibrotactile-sequence---haptics/hjif-haptic-json-format---haptics/hmpg-haptic-mpeg-format--
-content-type-in-practice-

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

HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Content-Length: 4820

<!doctype html>...

Client request

POST /api/users HTTP/1.1
Host: api.example.re
Content-Type: application/json
Content-Length: 52

{"name":"Jane Doe","email":"jane@example.re"}

Content negotiation

The 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

GET /data HTTP/1.1
Host: api.example.re
Accept: application/json, text/csv;q=0.8

Response

HTTP/1.1 200 OK
Content-Type: application/json
Vary: Accept

The Vary header tells caches the response depends on the Accept header, ensuring cached responses match the requested format.

MIME sniffing

When 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: nosniff header disables MIME sniffing, forcing the browser to respect the declared type:

X-Content-Type-Options: nosniff

SEO and Content-Type

Googlebot processes content based on the Content-Type header. Serving HTML with an incorrect Content-Type (like application/octet-stream) prevents indexing. JSON-LD structured data requires the application/ld+json type in <script> tags for search engines to recognize the markup.

Takeaway

Media 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