Content-Length

The size of the message body in decimal octets. Required when a body is present (unless chunked).

Both

Syntax

Content-Length: <length>

Example values

ValueExplanation
42Body is 42 bytes
0Empty body

cURL usage

curl -X POST -d '{"a":1}' https://api.example.com  # Auto-set

Common mistakes

Mismatch between Content-Length and actual body; required for POST/PUT.

Related headers

Tools

HTTP Header Viewer →