206 Partial Content
The server is successfully fulfilling a range request for the target resource.
Meaning & Description
This status code is commonly used for resumable downloads and video streaming, allowing the client to request specific byte ranges rather than downloading the entire file at once. If a single range is requested, the response must include a `Content-Range` header. If multiple ranges are requested, a `multipart/byteranges` payload is returned.
Common Causes
- The client included a valid `Range` header in its GET request, and the server supports byte-range requests.
How to fix a 206 error
- Verify that the `Content-Range` header matches the actual bytes sent.
- Check that the `Content-Length` header corresponds to the size of the payload being transferred, not the full resource size.
- Ensure your server explicitly advertises support with `Accept-Ranges: bytes`.
Browser & SEO Behaviour
Browser Behavior
Browsers automatically use 206 responses to buffer HTML5 <video> and <audio> elements, requesting chunks as the user scrubs through the timeline.
SEO Impact
No direct SEO impact, but supporting range requests improves Core Web Vitals (LCP) if you are serving large media files, leading to a better user experience.
CDN Behavior
Most CDNs support byte-range caching. They will request the full file from the origin but serve 206 Partial Content to the client from the edge.
Code Examples
GET /video.mp4 HTTP/1.1
Host: example.com
Range: bytes=0-1023app.get('/video', (req, res) => {
const range = req.headers.range;
if (!range) {
return res.status(400).send('Requires Range header');
}
const videoSize = fs.statSync('video.mp4').size;
const CHUNK_SIZE = 10 ** 6; // 1MB
const start = Number(range.replace(/\D/g, ''));
const end = Math.min(start + CHUNK_SIZE, videoSize - 1);
const contentLength = end - start + 1;
const headers = {
'Content-Range': `bytes ${start}-${end}/${videoSize}`,
'Accept-Ranges': 'bytes',
'Content-Length': contentLength,
'Content-Type': 'video/mp4',
};
res.writeHead(206, headers);
const videoStream = fs.createReadStream('video.mp4', { start, end });
videoStream.pipe(res);
});import os
from fastapi import Request, Response
from fastapi.responses import StreamingResponse
@app.get("/video")
def get_video(request: Request):
file_path = "video.mp4"
file_size = os.path.getsize(file_path)
range_header = request.headers.get("Range")
if not range_header:
return Response(status_code=400)
start = int(range_header.split("=")[1].split("-")[0])
end = min(start + 10**6, file_size - 1)
def iterfile():
with open(file_path, "rb") as f:
f.seek(start)
yield f.read(end - start + 1)
headers = {
"Content-Range": f"bytes {start}-{end}/{file_size}",
"Accept-Ranges": "bytes"
}
return StreamingResponse(iterfile(), status_code=206, headers=headers)func serveVideo(w http.ResponseWriter, r *http.Request) {
// http.ServeFile handles range requests automatically
// If the client sends a Range header, Go will return 206 Partial Content
http.ServeFile(w, r, "video.mp4")
}curl -H "Range: bytes=0-1023" -i https://example.com/video.mp4Raw HTTP Response Example
HTTP/1.1 206 Partial Content
Date: Wed, 15 Nov 2026 06:25:24 GMT
Content-Range: bytes 21010-47021/47022
Content-Length: 26012
Content-Type: video/mp4
[...partial binary data...]Real-world Examples
Frequently Asked Questions
What is the difference between 200 OK and 206 Partial Content?
A 200 OK means the server is sending the entire requested resource. A 206 Partial Content means the server is only sending a specific slice of the resource, precisely answering a client's Range request.
What happens if a client requests a range that doesn't exist?
If the requested range is out of bounds (for example, starting after the end of the file), the server should return a 416 Range Not Satisfiable status code.
Can a single 206 response return multiple ranges?
Yes. If a client requests multiple disjoint ranges, the server can return a 206 status with a `Content-Type: multipart/byteranges` payload, where each part represents one requested range.
Do I have to support 206 Partial Content on my API?
No, it is entirely optional. If a client sends a Range header and your server does not support it, you can simply ignore the header and return the full resource with a 200 OK.
How does the client know the server supports range requests?
The server should include the `Accept-Ranges: bytes` header in its standard 200 OK responses to signal that clients can use range requests in subsequent calls.
Did You Know?
Without HTTP 206, seeking in a 2-hour long web video would require downloading all the data before the seek point first.
Download managers like IDM use 206 Partial Content to open multiple concurrent connections to a server, downloading different chunks of the same file simultaneously to maximize speed.
PDF files are optimized for byte-range requests. A "Fast Web View" PDF places the cross-reference table at the beginning so clients can fetch exactly the bytes they need for a specific page.
Developer Tips
- Always validate the `Range` header carefully; malicious clients can send massive or overlapping ranges to cause denial-of-service via memory exhaustion (a vulnerability known as RangeAmp).
- When implementing 206 responses manually, do not forget the `Content-Range` header, or the client will reject the response.
- For static files, avoid writing custom range-handling logic. Standard web servers (Nginx, Apache) and modern frameworks handle this out-of-the-box securely.
- If your backend streams data of unknown size on-the-fly, you cannot use byte ranges since `Content-Range` requires the total resource length.
Interview Questions
These are questions you might face in a backend or API design interview that touch on HTTP 206.
How do you implement resumable file downloads in HTTP?
By utilizing HTTP Range requests. The client sends a `Range: bytes=start-` header indicating where the download left off. The server responds with `206 Partial Content`, a `Content-Range` header, and only the remaining bytes.
What header does a server use to announce it supports range requests?
The server sends the `Accept-Ranges: bytes` header. If it does not support them, it sends `Accept-Ranges: none`.
What status code is returned if a Range request is completely out of bounds?
The server returns `416 Range Not Satisfiable`.
Common Interview Mistakes
- Assuming 206 Partial Content is used for paginated REST API responses (like `/users?page=2`). It is strictly for byte-range requests of a single resource representation, not application-level data pagination.
- Forgetting that a 206 response absolutely requires the `Content-Range` header. Without it, the response is structurally invalid.