Back to HTTP Headers
Both

HTTP Content-Length Header

Indicates the size of the response body in bytes. Helps the client know how much data to expect and when the response is complete.

Purpose

Tells the receiver the exact size of the message body in bytes for proper data handling.

Content-Length: <bytes> Example: Content-Length: 348

Code Examples

See how to use the Content-Length header in different tools and languages.

curl -I https://api.example.com/data
# Response header:
# Content-Length: 2847

curl -H "Content-Length: 42" -X POST -d '{"key":"value"}' https://api.example.com/data

Related Headers

Test Your APIs

content-length headerhttp content-lengthhttp headers guide