Content-Range
When a server delivers only part of a resource, the HTTP Content-Range response header identifies which byte range the message contains and the total resource size.
Usage
The Content-Range header appears in 206 Partial Content responses when a server fulfills a Range request by delivering only part of a resource. The header specifies the byte range of the partial content and the total size of the complete resource.
Range requests enable efficient downloads. A client interrupted during a large file transfer resumes from where the connection dropped instead of starting over. Media players use range requests to seek to specific positions in audio or video files without downloading the entire stream.
Servers advertise range request support through the
Accept-Ranges header, typically set to
bytes. When a range request asks for a byte range beyond the
resource boundary, the server responds with
416 Range Not Satisfiable and includes a
Content-Range header showing the actual resource size.
The syntax follows a structured format with three components:
the unit (almost always bytes), the byte range, and the
complete size.
Content-Range: <unit> <range-start>-<range-end>/<size>
Directives
unit
The unit type for the range. The value bytes is the only
widely implemented unit.
range-start
A zero-based integer indicating the first byte of the returned range.
range-end
A zero-based integer indicating the last byte of the returned range, inclusive.
size
The total size of the complete resource in bytes. An
asterisk (*) replaces the size when the total length is
unknown, as with streaming or dynamically generated content.
Example
A client resumes a download starting at byte 1000 of a file with a total size of 65,000 bytes. The server returns bytes 1000 through 2000 inclusive.
Content-Range: bytes 1000-2000/65000
A streaming resource delivers a range without knowing the total size. The asterisk indicates an unknown complete length.
Content-Range: bytes 1000-2000/*
A server rejects a range request because the requested bytes exceed the resource size. The response carries a 416 Range Not Satisfiable status and reports the actual size.
HTTP/1.1 416 Range Not Satisfiable
Content-Range: bytes */50000
A multipart range response delivers multiple ranges in a
single response. Each part includes its own
Content-Range header within the multipart/byteranges
body.
HTTP/1.1 206 Partial Content
Content-Type: multipart/byteranges; boundary=BOUNDARY
--BOUNDARY
Content-Type: text/plain
Content-Range: bytes 0-499/10000
[first 500 bytes]
--BOUNDARY
Content-Type: text/plain
Content-Range: bytes 9500-9999/10000
[last 500 bytes]
--BOUNDARY--
Note
Content-Length states the total size of the message body in bytes. Content-Range identifies which specific byte segment of the complete resource the current response contains. A full response uses Content-Length alone; a 206 Partial Content response uses both headers together.