416 Range Not Satisfiable
The client asked for a portion of a file that cannot be supplied by the server.
Meaning & Description
Common Causes
- The client requests a byte offset greater than or equal to the file's total length.
- The file was modified and truncated on the server since the client last requested a chunk.
- Malformed `Range` headers in custom HTTP clients.
How to fix a 416 error
- Check the `Content-Range` header in the 416 response. The server should include the actual total length of the file (e.g., `Content-Range: bytes */1234`).
- Update your client logic to ensure it requests ranges within the valid bounds [0, length-1].
- If resuming a download, ensure the file hasn't been replaced with a newer, smaller version.
Browser & SEO Behaviour
Browser Behavior
When playing HTML5 `<video>` or `<audio>`, browsers make heavy use of byte-range requests. If they receive a 416, they generally stop playback or abort the request.
SEO Impact
No direct SEO impact. Search engine crawlers do not typically request partial byte ranges.
CDN Behavior
CDNs support byte-range caching intimately. If a client requests an invalid range, the CDN will directly answer with a 416 and the `Content-Range` header based on its cached file size.
Code Examples
HTTP/1.1 416 Range Not Satisfiable
Content-Range: bytes */1234
Content-Type: text/plain
Requested range is out of bounds.app.get("/video", (req, res) => {
const fileSize = 1234;
const range = req.headers.range;
if (range) {
// Simplified parsing
const parts = range.replace(/bytes=/, "").split("-");
const start = parseInt(parts[0], 10);
if (start >= fileSize) {
res.status(416).header("Content-Range", `bytes */${fileSize}`).send();
return;
}
}
res.send("Video content...");
});from fastapi import FastAPI, Header, Response
app = FastAPI()
@app.get("/download")
async def download(range: str = Header(None)):
file_size = 1000
if range and range.startswith("bytes="):
start = int(range.replace("bytes=", "").split("-")[0])
if start >= file_size:
headers = {"Content-Range": f"bytes */{file_size}"}
return Response(status_code=416, headers=headers)
return {"message": "Success"}func handler(w http.ResponseWriter, r *http.Request) {
// Use http.ServeFile which handles byte ranges automatically
// If the range is invalid, it will return 416 internally
http.ServeFile(w, r, "video.mp4")
}// ASP.NET Core PhysicalFileResult handles range requests automatically.
[HttpGet("media")]
public IActionResult GetMedia()
{
return PhysicalFile("/path/to/media.mp4", "video/mp4", enableRangeProcessing: true);
}# Requesting bytes 5000-6000 from a file that is smaller than 5000 bytes
curl -r 5000-6000 https://api.example.com/small_file.txtRaw HTTP Response Example
HTTP/1.1 416 Range Not Satisfiable
Date: Wed, 21 Oct 2026 07:28:00 GMT
Content-Range: bytes */5000000
Content-Type: text/plain
Requested range is out of bounds.Real-world Examples
Frequently Asked Questions
What does Content-Range: bytes */100 mean in a 416 response?
The asterisk (*) indicates that the requested range was invalid, and the number after the slash (100) indicates the actual total size of the file in bytes. This helps the client correct its request.
Why am I getting a 416 error when downloading a PDF or video?
Your download manager or browser requested a specific chunk of the file, but asked for bytes that do not exist (e.g., asking for byte 500 of a 200-byte file).
Do I need to implement Range support in my API?
Usually not for standard JSON APIs. Range support is critical for serving large static files like video, audio, or large PDFs where clients want to stream or resume downloads.
Did You Know?
The 416 status code was previously known as "Requested Range Not Satisfiable" but was shortened in RFC 7233.
HTTP range requests are zero-indexed. The first byte is byte 0. If a file is 100 bytes long, valid ranges are from 0 to 99.
Developer Tips
- Do not implement byte-range parsing manually if you can avoid it. Most web servers (Nginx, Apache) and web frameworks have built-in static file handlers that do this safely and correctly.
- When returning a 416, always include the `Content-Range` header with the actual file length. This allows clients (like download managers) to self-correct.
Interview Questions
These are questions you might face in a backend or API design interview that touch on HTTP 416.
How do HTTP Range requests work, and when is a 416 returned?
A client sends a `Range: bytes=start-end` header to fetch a portion of a file, typically for video streaming or resuming downloads. If the requested range overlaps with the file, the server returns 206 Partial Content. If the range falls entirely outside the file size, it returns 416.
If a client requests `bytes=50-` for a file that is 100 bytes long, what should the server do?
The server should return a 206 Partial Content response, serving bytes 50 through 99, along with a `Content-Range: bytes 50-99/100` header. It should not return a 416.
Common Interview Mistakes
- Failing to mention the `Content-Range` header when explaining how to resolve a 416 error.
- Confusing a 416 error with a 404 Not Found. 416 implies the file exists, but the requested *slice* of it does not.