1001Ferramentas
📋 Dev

Content-Type Parser

Decompose a Content-Type header into mediatype, charset, boundary and other parameters. Useful when debugging APIs and uploads.

Content-Type: type, subtype and parameters

Content-Type states how to interpret the message body, and its structure is richer than everyday use suggests: type, slash, subtype, then as many parameters as needed, each preceded by a semicolon. Paste the value and the page separates all of it, stripping quotes from parameters where present.

The most consequential parameter is charset. Without it on text content the browser guesses — and guesses differently depending on version and configuration, which produces the classic mangled-accents text that shows up for only some visitors. For HTML there is also a precedence rule: the HTTP header beats the declaration inside the document.

Worth knowing about the structured suffix, the part after the plus sign: in application/ld+json or image/svg+xml it states the base syntax. That lets a client which does not know the specific type still process it as JSON or XML. It is the mechanism that lets a new type be useful without every piece of software knowing it.

Frequently asked questions

Do I need to declare charset on JSON?
No, and the application/json specification goes as far as dispensing with the parameter: JSON is defined as UTF-8. Declaring it does no harm, but declaring a charset other than UTF-8 does, because many clients ignore the parameter and read it as UTF-8 regardless.
What is the difference between Content-Type and content sniffing?
The header is the server's declaration; sniffing is the browser's guess from the first bytes. When they disagree, older browsers followed the guess, which became an attack vector — a file uploaded as text and executed as script. The nosniff header exists to switch that guessing off.
Why does boundary appear in the Content-Type?
Because in multipart the body is split into parts by a marker, and the marker has to be known before reading the body. It travels as a parameter for exactly that reason, and it must be a sequence that does not occur inside any part — hence the long, random-looking values.

Related Tools