Content-Type and character set
The Content-Type header says what the bytes of the body are. Browsers and programs choose how to treat the data from it.
A real example
GET /json HTTP/1.1
Host: example.com
HTTP/1.1 200 OK
Date: Sat, 14 Nov 2026 10:00:00 GMT
Content-Type: application/json
Content-Length: 7
{"a":1}Common values
| Value | Used for |
|---|---|
text/html; charset=utf-8 | Web pages |
text/css and text/javascript | Styles and scripts |
application/json | JSON data from APIs |
application/x-www-form-urlencoded | A normal HTML form body |
multipart/form-data | Forms with file uploads |
image/png, image/webp, image/jpeg | Pictures |
application/pdf | PDF files |
application/octet-stream | Unknown binary data, often shown as a download |
The character set
Text types should say how the letters are encoded. charset=utf-8 is the right choice for nearly everything today and covers Hindi, Punjabi and every other script. Without it, a browser guesses, and the guess can turn text into strange symbols. You can also set it inside the page with <meta charset="utf-8">; the header has priority.
When the type goes wrong
- A script is served as
text/plain, and the browser refuses to run it whenX-Content-Type-Options: nosniffis on. - A download opens as text because the type is
text/html. - An API answers 415 Unsupported Media Type because the request body was sent without
Content-Type: application/json. - A file shows as a download instead of a picture because the type is
application/octet-stream.
Paste a response into the header checker: it notes a missing type and a missing charset on HTML.
Does the file extension decide the type?
Not for browsers on the web: they use the header. Servers often choose the header from the extension, so the extension matters indirectly.
Sources
- RFC 9110 section 8.3 (Content-Type)
Read on 14 November 2026.
This is an independent guide. It is not connected with the IETF, IANA, any browser maker or any company named here. Meanings were checked against the RFC texts on 14 November 2026. Responses shown were recorded on 14 November 2026 from a small test server on the author's own computer.