HTTP Content Types

Meanings and examples of common HTTP Content-Type media types — JSON, HTML, forms, images, audio, video and file downloads — with charset and multipart boundary notes.

Content-TypeMeaningExample
application/jsonJSON structured dataContent-Type: application/json; charset=utf-8
application/xmlXML dataapplication/xml; charset=utf-8
text/htmlHTML documenttext/html; charset=utf-8
text/plainPlain texttext/plain; charset=utf-8
application/x-www-form-urlencodedDefault HTML form encodingapplication/x-www-form-urlencoded
multipart/form-dataFile upload formmultipart/form-data; boundary=----WebKitFormBoundaryABC
application/octet-streamUnknown binary stream (triggers download)application/octet-stream
image/pngPNG imageimage/png
image/jpegJPEG imageimage/jpeg
image/svg+xmlSVG vector imageimage/svg+xml
audio/mpegMP3 audioaudio/mpeg
video/mp4MP4 videovideo/mp4
application/pdfPDF documentapplication/pdf
application/zipZIP archiveapplication/zip
font/woff2WOFF2 fontfont/woff2
application/javascriptJavaScript scriptapplication/javascript; charset=utf-8
application/ld+jsonStructured data (JSON-LD)application/ld+json
application/gzipGzip compressed dataapplication/gzip

Frequently Asked Questions

What happens if charset is omitted in Content-Type?

Without charset, the browser guesses the encoding (often ISO-8859-1 or a locale default), and UTF-8 text like Chinese easily turns into mojibake. Always set charset=utf-8 for text types. Binary types (image/*, application/octet-stream) do not need charset.

What is the boundary in multipart/form-data?

boundary is the delimiter separating each form field, prefixed with two hyphens (e.g. --boundary), used to split parts. The client generates it randomly; you never write it by hand — the server parses fields and files by the Boundary.

Should I use application/json or text/json?

Use application/json — it is the IANA-registered, universally recognized type. text/json is non-standard and may be misclassified by legacy systems or firewalls, so avoid it.

Why do download endpoints return application/octet-stream?

octet-stream means "unknown binary"; browsers usually will not preview it and instead trigger a download (especially with Content-Disposition: attachment). Good for exports, installers and similar files.