← Back to headers
HTTP Header
Content-Length
ResponseSpecifies the size of the message body in bytes.
HTTP header reference, syntax, examples, and developer usage.
What is the Content-Length header?
The Content-Length HTTP header is used to transmit metadata between a client and server as part of HTTP requests or responses.
HTTP headers define how content should be interpreted, cached, authenticated, secured, or processed by browsers and APIs.
Direction
This is a response header sent by the server to the client.
Syntax
Content-Length: <bytes>
Example
Content-Length: 348
Common use cases
- Message framing
- Uploads and downloads
- Server validation of request size
Common mistakes
- Using the header in the wrong request or response context
- Sending invalid header values
- Incorrect header syntax
- Assuming the header automatically changes server behaviour