Range
request headercontent
Asks for only part of a resource — how downloads resume and how video seeks.
Range lets a client fetch a slice of a resource instead of the whole thing. Browsers use it to seek in audio and video; download managers use it to resume. A server that supports it answers 206 Partial Content with a Content-Range header saying which bytes it sent. One that doesn't simply returns the whole resource with 200.
Syntax
Range: bytes=<start>-<end>[, <start>-<end>…]
Defined in RFC 9110 §14.2 — Range.
Values
| bytes=0-499 | the first 500 bytes |
|---|---|
| bytes=500- | from byte 500 to the end |
| bytes=-500 | the last 500 bytes |
Examples
Range: bytes=0-1023
the first kilobyte
Range: bytes=1048576-
resume from the 1 MB mark
Good to know
- Ranges are inclusive and start at 0:
bytes=0-499is 500 bytes. - Send
If-Rangewith an ETag when resuming, so the download restarts cleanly if the file changed meanwhile. - A range that starts past the end of the file gets 416 Range Not Satisfiable.
How to set Range
# Resume an interrupted download curl -C - -O https://example.com/big.iso # Fetch the first kilobyte curl -r 0-1023 https://example.com/file.bin -o first-kb.bin
const res = await fetch("/video.mp4", { headers: { Range: "bytes=0-1023" } });
res.status; // 206 if ranges are supported
res.headers.get("Content-Range"); // "bytes 0-1023/52428800"Check it
In the browser, open DevTools → Network, pick a request and look under Request Headers. From the command line, curl's verbose mode prints every header it sends, prefixed with >:
curl -sv https://example.com/ -o /dev/null 2>&1 | grep '^>'
Frequently asked questions
Why won't my video seek in Safari?
Safari requires byte-range support for media. If the server ignores Range and returns the whole file with 200, playback or seeking fails — serve the file from a static server, object storage or a CDN, which support ranges.