206

Partial Content

2xx Success

ELI5

You asked for just a piece of a file (like pages 5-10 of a book), and here's that specific piece you wanted!

Server perspective

Use 206 when a valid Range request asks for one or more portions of a representation.

When to use

  • Return 206 for resumable downloads, media seeking, and partial fetches
  • Use it only when the request included a satisfiable range
  • Video/audio streaming with range requests
  • Large file downloads that support resume functionality
  • PDF page range requests
  • Image tile serving for maps or large images
  • Any scenario where clients request specific byte ranges

How to respond

  • Include Content-Range for single-range responses
  • Use multipart/byteranges when returning multiple ranges
  • Do not send a top-level Content-Range header on multipart responses; each body part carries its own Content-Range

Headers to consider

  • Content-Range
  • Accept-Ranges
  • Content-Type
  • If-Range — sent by the client to make the range request conditional; validate it before responding with 206 to avoid delivering partial content from a stale representation.

Response body

  • Return the requested range bytes, or multipart body parts for multiple ranges

Server-side pitfalls

  • Do not use 206 when the client did not ask for a range
  • Return 416 instead when the requested range cannot be satisfied
  • Do not send a top-level Content-Range header together with a multipart/byteranges response
  • When no Range header was provided (use 200 OK)
  • When the Range request is invalid (use 416 Range Not Satisfiable)
  • For small files where partial content doesn't make sense
  • When the server doesn't support range requests

Examples

Video streaming

Request:GET https://api.example.test/video.mp4 # Headers Range: bytes=1000000-2000000
Response:206 Partial Content # Headers Content-Range: bytes 1000000-2000000/50000000 # Body <partial representation>

The server returns only the requested portion of the file instead of the entire video.

Resume file download

Request:GET https://api.example.test/largefile.zip # Headers Range: bytes=5242880-
Response:206 Partial Content # Headers Content-Range: bytes 5242880-10485759/10485760 # Body <partial representation>

The client resumes a download from byte 5 MB instead of starting the transfer over.

References

Related Status Codes