# Range Header — Syntax, Values & Examples

> 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](https://www.devkult.com/http/206.md) with a `Content-Range` header saying which bytes it sent. One that doesn't simply returns the whole resource with 200.

- Type: Request header
- Category: Content
- Defined in: [RFC 9110 §14.2 — Range](https://www.rfc-editor.org/rfc/rfc9110.html#section-14.2)

## Syntax

```http
Range: bytes=<start>-<end>[, <start>-<end>…]
```

## Values

| Value | Meaning |
|---|---|
| `bytes=0-499` | the first 500 bytes |
| `bytes=500-` | from byte 500 to the end |
| `bytes=-500` | the last 500 bytes |

## Examples

```http
Range: bytes=0-1023
```

the first kilobyte

```http
Range: bytes=1048576-
```

resume from the 1 MB mark

## Good to know

- Ranges are inclusive and start at 0: `bytes=0-499` is 500 bytes.
- Send `If-Range` with 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](https://www.devkult.com/http/416.md).

## How to set Range

### curl

```
# 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
```

### fetch

```
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 `>`:

```sh
curl -sv https://example.com/ -o /dev/null 2>&1 | grep '^>'
```

## FAQ

### 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.

## Status codes it appears with

- [206 Partial Content](https://www.devkult.com/http/206.md)
- [416 Range Not Satisfiable](https://www.devkult.com/http/416.md)

## Related headers

- [Accept-Ranges](https://www.devkult.com/headers/accept-ranges.md): Tells clients the server supports byte-range requests on this resource.
- [Content-Length](https://www.devkult.com/headers/content-length.md): The size of the message body in bytes.
- [ETag](https://www.devkult.com/headers/etag.md): An identifier for a specific version of a resource, used to revalidate cached copies and to prevent lost updates.

Open the interactive page: https://www.devkult.com/headers/range