2xx SuccessRFC 9110

206Partial Content

Server is returning partial content due to a Range request.

What it means

The server is returning only part of the resource due to a Range header in the request. Used for resumable downloads, video streaming, and large file transfers where only a portion of the content is requested.

When to use it

  • Video/audio streaming (YouTube, Spotify use this)
  • Resumable file downloads
  • Paginated content delivery
  • Client requests a specific byte range

Code Examples

Express — Serve video with range support
javascript
app.get('/video/:id', (req, res) => {
  const range = req.headers.range;
  if (!range) return res.status(400).send('Range required');

  const videoSize = fs.statSync(videoPath).size;
  const [start, end] = range.replace(/bytes=/, '').split('-').map(Number);
  const chunkSize = end - start + 1;

  res.status(206).set({
    'Content-Range': `bytes ${start}-${end}/${videoSize}`,
    'Content-Length': chunkSize,
    'Content-Type': 'video/mp4',
  });
  fs.createReadStream(videoPath, { start, end }).pipe(res);
});

Don't confuse with

Quick Facts

Code206
CategorySuccess
SpecRFC 9110
CommonNo

Relevant Headers

Content-Range

The byte range of the content being returned

Range

Request header specifying the desired byte range

Related Codes

← Back to all status codes