← Back to Chapters

HTTP 206 – Partial Content

? HTTP 206 – Partial Content

? Quick Overview

The 206 Partial Content HTTP status code indicates that the server is successfully delivering only a portion of the requested resource. This response is commonly used when a client sends a Range header to request specific byte ranges of a file.

? Key Concepts

  • Used with the Range request header
  • Returns only part of a resource instead of the full content
  • Essential for resumable downloads and media streaming
  • Often includes Content-Range response header

? Syntax / Theory

When a client requests a specific portion of a resource using byte ranges, the server responds with status code 206 and sends only that portion.

If the server does not support range requests, it may ignore the header and return 200 OK instead.

? Code Example(s)

? View Code Example
// Client requesting only first 500 bytes of a file
GET /video.mp4 HTTP/1.1
Host: example.com
Range: bytes=0-499
? View Code Example
// Server response with partial content
HTTP/1.1 206 Partial Content
Content-Range: bytes 0-499/2000
Content-Length: 500

? Live Output / Explanation

The server sends back only the requested byte range instead of the full file. This reduces bandwidth usage and improves performance for large files.

?️ Interactive Example / Visual Explanation

Think of a large file as a long book. Instead of downloading the entire book, the client asks only for specific pages. The server sends just those pages, resulting in a 206 Partial Content response.

Range Request Simulator

Total File Size: 1000 bytes

 
0 bytes 1000 bytes
Click "Request Content" to simulate...

? Use Cases

  • Video and audio streaming platforms
  • Resumable file downloads
  • Large dataset transfers
  • Efficient bandwidth usage on slow networks

✅ Tips & Best Practices

  • Always include proper Content-Range headers in responses
  • Ensure byte ranges are valid to avoid errors
  • Use caching carefully with partial responses

? Try It Yourself

  • Send a request with different byte ranges using browser dev tools
  • Test resumable downloads using a large file
  • Observe how media players request partial content