Content-Type for Binary File Downloads

Set the Content-Type header for generic binary data using application/octet-stream. Covers when to use it and Content-Disposition pairing.

File Uploads

Detailed Explanation

application/octet-stream

application/octet-stream is the generic binary data Content-Type. It tells the client that the body contains arbitrary binary data with no specific structure implied.

The Header Value

Content-Type: application/octet-stream

When to Use

Use application/octet-stream when:

  • The file type is unknown or has no registered MIME type
  • You want to force a download (paired with Content-Disposition)
  • Sending raw binary data in a request body
  • Streaming binary data of unspecified format

Pairing with Content-Disposition

To trigger a file download in the browser, pair with the Content-Disposition header:

Content-Type: application/octet-stream
Content-Disposition: attachment; filename="backup-2025-01-15.bin"

Prefer Specific Types When Possible

If you know the actual file type, use its specific Content-Type instead:

File Type Preferred Content-Type
PDF application/pdf
ZIP application/zip
PNG image/png
MP4 video/mp4
WASM application/wasm

Using specific types enables browsers and clients to handle the file appropriately (inline display, correct app association, etc.).

curl Example

# Sending binary data
curl -X PUT \
  -H "Content-Type: application/octet-stream" \
  --data-binary @firmware.bin \
  https://api.example.com/upload/firmware

Use Case

Use this for firmware uploads, generic file downloads, binary data streaming, or any scenario where the specific file type is unknown. Also used as a fallback when the server cannot determine the MIME type.

Try It — Content-Type Header Builder

Open full tool