HTTP 206 Partial Content
2xx Success
- Home
- HTTP Status Codes
- 2xx
- 206
What is HTTP 206 Partial Content?
The 206 (Partial Content) status code indicates that the server is successfully fulfilling a range request for the target resource by transferring one or more parts of the selected representation. This enables resumable downloads and streaming media playback where the client can request specific byte ranges.
Common Use Cases
- Resumable file downloads
- Video streaming with seeking
- Large file downloads with chunked transfer
Usage Example
When implementing a video streaming service, the client requests specific byte ranges using the Range header. The server responds with 206 Partial Content, including the Content-Range header indicating which bytes are being delivered. This allows users to skip to any part of the video without downloading the entire file.
// PHP - serving partial content for video streaming
$file = 'videos/large.mp4';
$size = filesize($file);
$range = $_SERVER['HTTP_RANGE'] ?? null;
if ($range && preg_match('/bytes=(\d+)-(\d*)/', $range, $m)) {
http_response_code(206);
header("Content-Range: bytes {$m[1]}-{$m[2]}/$size");
// Output only the requested byte range
}
Related Status Codes
Common Mistakes
Mistake: Returning 200 instead of 206 for range requests
Fix: When a client sends a Range header and you serve partial content, always respond with 206 Partial Content and include the Content-Range header. Returning 200 with the full file defeats the purpose of range requests.
Mistake: Omitting the Content-Range header in a 206 response
Fix: Every 206 response must include a Content-Range header indicating which bytes of the total resource are being delivered. Without it, the client cannot reassemble the file correctly.