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-Type | Meaning | Example |
|---|---|---|
| application/json | JSON structured data | Content-Type: application/json; charset=utf-8 |
| application/xml | XML data | application/xml; charset=utf-8 |
| text/html | HTML document | text/html; charset=utf-8 |
| text/plain | Plain text | text/plain; charset=utf-8 |
| application/x-www-form-urlencoded | Default HTML form encoding | application/x-www-form-urlencoded |
| multipart/form-data | File upload form | multipart/form-data; boundary=----WebKitFormBoundaryABC |
| application/octet-stream | Unknown binary stream (triggers download) | application/octet-stream |
| image/png | PNG image | image/png |
| image/jpeg | JPEG image | image/jpeg |
| image/svg+xml | SVG vector image | image/svg+xml |
| audio/mpeg | MP3 audio | audio/mpeg |
| video/mp4 | MP4 video | video/mp4 |
| application/pdf | PDF document | application/pdf |
| application/zip | ZIP archive | application/zip |
| font/woff2 | WOFF2 font | font/woff2 |
| application/javascript | JavaScript script | application/javascript; charset=utf-8 |
| application/ld+json | Structured data (JSON-LD) | application/ld+json |
| application/gzip | Gzip compressed data | application/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.