206 Partial Content

The HTTP 206 is a response code servers use for successful range requests.

For example, when streaming a video, you might want to receive it in chunks (because why waste the bandwidth if you only need a small fraction of the file). You can request a portion of the file by including the Range HTTP header:

Range: bytes=0-

The above header asks the server to send the slice of the data starting from the 0th byte and beyond. This is also known as byte serving or range requests.

If the range is valid and the server supports range requests, you will receive the requested chunk with a 206 Partial Content status code. When responding to a range request, the server includes the Content-Range header indicating which bytes server is responding with:

HTTP/2 206 Partial Content
Accept-Ranges: bytes
Content-Range: bytes 0-1459/42042
Content-Length: 1500

The above Content-Range header means that the server returned the first 1500 bytes of the file, and the total file size is 42042 bytes.

Servers are free to ignore the Range header, in which case, they will return the entire resource in one swoop with a 200 OK status code.

Transport layer

Range requests happen on the application layer (HTTP).

Regardless of whether a client uses a range request, the data will be broken down into small chunks and transported in TCP or UDP packets.

Try it yourself

curl --verbose -H 'Range: bytes=0-' https://example.com

See also

416 Range Not Satisfiable status code is returned when the range request fails.

Interested in no-nonsense technical guides?

No spyware, no promotional emails, or keyword-stuffed junk. I will only send you a single email when I've got something interesting to say. Unsubscribe anytime.

You can also subscribe to the Atom feed (it's like RSS, but better).