← All headersGeneral header

What is a Content-Length header?

The size of the message body in bytes, letting the receiver know when the body has fully arrived.

Content-Length tells the client exactly how many bytes to expect, so it knows the response has finished arriving rather than just stalled mid-transfer. A website that gets this wrong - sending a length that doesn't match the actual body - produces truncated pages or downloads that silently cut off partway through, a class of failure that's easy to miss without a monitor actually validating full response bodies rather than just checking that a connection was made.

Common use case

Download progress bars and resumable file transfers rely on Content-Length to calculate percentage complete and detect a connection that dropped before the full file arrived.

Example

Content-Length: 48823

History

Part of the original HTTP/1.0 specification, RFC 1945 (1996).

Did you know?

It's mutually exclusive with chunked Transfer-Encoding - a response uses one or the other to signal where the body ends, never both at once.