How Content-Type works
On responses it decides what the browser does: render HTML, run a script, show an image or download a file. On requests it tells the server how to parse the body; a JSON body sent without Content-Type: application/json is a common reason frameworks see an empty request body.
Values
| Value | Meaning |
|---|---|
text/html; charset=utf-8
|
An HTML page. |
application/json
|
JSON. No charset needed: JSON is always UTF-8. |
application/x-www-form-urlencoded
|
A submitted HTML form (key=value&…). |
multipart/form-data; boundary=…
|
A form with file uploads. Let the browser set the boundary. |
application/octet-stream
|
Unknown binary data; browsers download it. |
Examples
Content-Type: text/html; charset=utf-8
Content-Type: application/json
Common mistakes
- When uploading files with fetch and FormData, don’t set Content-Type yourself: the browser has to add the multipart boundary, and a hand-written header won’t have it.
Check it
curl -sI https://example.com | grep -i '^content-type:'
Paste a full set of response headers into the HTTP header checker to get every header explained and common mistakes flagged.
Related headers
- Content-Disposition: tells the browser whether to show a response or download it, and under what file name.
- Accept: lists the response formats the client prefers, with optional weights.
- X-Content-Type-Options: stops browsers from guessing (“sniffing”) a response’s type instead of trusting Content-Type.
- Content-Encoding: names the compression applied to the body, such as gzip, br (Brotli) or zstd.
More content and negotiation headers
Accept-Encoding , Accept-Language , Content-Length , Range , Transfer-Encoding .
Sources
Spotted a mistake? Email hello@devtoolsmith.com and we’ll fix it.
Frequently asked questions
What does the Content-Type header do?
The Content-Type request and response header states the media type (MIME type) of the body, and for text, its character encoding. On responses it decides what the browser does: render HTML, run a script, show an image or download a file. On requests it tells the server how to parse the body; a JSON body sent without Content-Type: application/json is a common reason frameworks see an empty request body.
How do I see the Content-Type header?
Run "curl -sI https://example.com" to print a response’s headers, or open the Network tab in your browser’s dev tools and select the request. Paste the headers into the HTTP header checker on this site to get each one explained.