Skip to content

multipart/mixed MIME Type — Meaning, Usage & Examples

multipart/mixed
Extensions: — Class: multipart Spec: RFC 2046 (IANA registered)
View IANA registration ↗

multipart/mixed means: multipart/mixed is the general-purpose media type for a message containing several independent body parts of possibly different types, separated by a boundary. Unlike form-data it is not tied to HTML forms; it is used for batched payloads and MIME email with attachments. Multipart media types bundle several independent body parts into one message, separated by a boundary token declared in the Content-Type header. They are the backbone of HTML file uploads and mixed payloads. The boundary parameter is mandatory and must not appear inside any part, or parsers split the message at the wrong place and corrupt the upload. You will encounter multipart/mixed in contexts such as mime email messages combining text and attachments; batch http requests grouping multiple sub-requests; composite payloads where parts have unrelated media types. It is commonly associated with the file extension(s) no fixed file extension. Each part declares its own Content-Type, and the boundary must be unique and absent from part data. multipart/mixed implies parts are independent and ordered; use multipart/alternative when parts are equivalent representations of the same content.

Advertisement
Ad slot · ref-top

When you'll see multipart/mixed

  • MIME email messages combining text and attachments
  • Batch HTTP requests grouping multiple sub-requests
  • Composite payloads where parts have unrelated media types

How to handle it

When constructing a multipart body, let your HTTP library generate the boundary and assemble the parts — hand-rolling boundaries is error-prone. Each form-data part needs a Content-Disposition with a name, and file parts need a filename and their own Content-Type. On the server, use a streaming multipart parser to avoid buffering large uploads entirely in memory, and enforce size limits per part and per request. As a final checklist for multipart types: let libraries generate boundaries, stream-parse large uploads with per-part and per-request size limits, give each file part its own Content-Type, and reject unexpected parts early so malformed or oversized messages never exhaust server memory.

Notes & gotchas

Each part declares its own Content-Type, and the boundary must be unique and absent from part data. multipart/mixed implies parts are independent and ordered; use multipart/alternative when parts are equivalent representations of the same content.

Examples

HTTP
HTTP/1.1 200 OK
Content-Type: multipart/mixed
Content-Length: 78

Sample multipart/mixed content delivered with the correct Content-Type header.
curl
curl -i -H "Accept: multipart/mixed" https://api.example.com/v1/resource   # inspect the returned Content-Type
JavaScript (fetch)
const res = await fetch("/v1/resource", { headers: { Accept: "multipart/mixed" } });
// verify res.headers.get("Content-Type") starts with "multipart/mixed"
const text = await res.text();   // handle according to the declared type
Python (requests)
import requests

res = requests.get("https://api.example.com/v1/resource",
                   headers={"Accept": "multipart/mixed"}, timeout=10)
res.raise_for_status()
# confirm the server declared the expected type
assert res.headers["Content-Type"].startswith("multipart/mixed")
text = res.text   # decode/handle according to the type

Frequently asked questions

How does multipart/mixed differ from multipart/alternative?

mixed carries independent parts (e.g. body plus attachment); alternative carries equivalent versions of the same content (e.g. plain and HTML email) where the client picks the best one it supports.

Where is multipart/mixed used in HTTP?

In batch APIs and some upload protocols that group several sub-requests or files into one message, each part with its own headers and type.

Why is the boundary parameter required for multipart types?

It delimits the parts. The sender generates a unique token, declares it in Content-Type, and writes it between parts. If the token occurs inside a part's data, the parser splits incorrectly — libraries generate collision-safe boundaries for you.

What is the difference between multipart/form-data and multipart/mixed?

form-data is for HTML form submissions and file uploads (each part has a name and optional filename); mixed is a general container for unrelated parts. Browsers' FormData API produces form-data automatically with a correct boundary.

Why is my multipart upload rejected as malformed?

Usually the boundary in the Content-Type header does not match the delimiters in the body, or a part is missing its Content-Disposition. Let your HTTP library build the body so the boundary and parts stay consistent.

Advertisement
Ad slot · ref-in-article

Try the URL Encoder

Percent-encode and decode URL components or full URLs.

Open tool →