DevTools Logo

MIME Types Cheat Sheet

Common MIME types, Content-Type headers, multipart forms, and how to detect and set them correctly.

Web & Network
mime
content-type
http

MIME types (media types) tell the browser and servers how to interpret a resource. The Content-Type header declares the type and, optionally, a charset or boundary.

Common MIME types

Table
TypeExtension
text/html.html
text/css.css
text/plain.txt
application/json.json
application/javascript.js
application/xml.xml
image/png.png
image/jpeg.jpg
image/svg+xml.svg
image/webp.webp
application/pdf.pdf
application/zip.zip
application/octet-stream(binary fallback)
multipart/form-data(file uploads)

Content-Type header

code
Content-Type: text/html; charset=utf-8
Content-Type: application/json
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary
Table
ComponentMeaning
type/subtypeThe media type.
charsetCharacter encoding (text types).
boundarySeparator for multipart bodies.

Multipart form data

code
------WebKitFormBoundary
Content-Disposition: form-data; name="file"; filename="a.png"
Content-Type: image/png

<binary data>
------WebKitFormBoundary--

Detection

Table
MethodNotes
File extensionSimple but spoofable.
Magic bytesInspect file signature (e.g. %PDF, \x89PNG).
Server Content-TypeTrust but verify for uploads.

References

Related tools