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

`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 API error details
Content-Type: application/json

JSON requires UTF-8 encoding for network transmission. The charset parameter has no effect and is not defined for application/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 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/*

Type Description
message/rfc822 Email message
message/http HTTP message
message/partial Fragment of a larger message
message/global Internationalized email
message/ohttp-req Oblivious HTTP request
message/ohttp-res Oblivious HTTP response
message/bhttp Binary HTTP message

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 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 6, 2026