MIME Types
The media types you are likely to send or receive, with their file extensions, and how the Content-Type header around them works. The common ones have a page of their own with curl and fetch examples.
Common MIME types
| Type | Extensions | What it is | Guide |
|---|---|---|---|
| Text | |||
| text/plain | .txt | Plain text, no markup. | Guide to text/plain |
| text/html | .html .htm | An HTML document. | Guide to text/html |
| text/css | .css | A stylesheet. | |
| text/javascript | .js .mjs | JavaScript, scripts and modules alike. | Guide to text/javascript |
| text/csv | .csv | Comma-separated values, one record per line. | Guide to text/csv |
| text/tab-separated-values | .tsv | Tab-separated values. | |
| text/markdown | .md | Markdown text. | |
| text/calendar | .ics | An iCalendar event or calendar. | |
| text/vcard | .vcf | A contact card. | |
| text/event-stream | Server-sent events: a stream of messages over one response. | Guide to text/event-stream | |
| Application | |||
| application/json | .json | JSON data. | Guide to application/json |
| application/ld+json | .jsonld | JSON-LD linked data, as used for structured data in web pages. | |
| application/problem+json | An API error in the RFC 9457 problem details format. | ||
| application/x-ndjson | .ndjson | Newline-delimited JSON: one JSON value per line. | |
| application/xml | .xml | An XML document. | Guide to application/xml |
| application/atom+xml | .atom | An Atom feed. | |
| application/rss+xml | .rss | An RSS feed. | |
| application/yaml | .yaml .yml | YAML, registered in 2024 (RFC 9512); older servers send other names. | |
| application/x-www-form-urlencoded | Form fields as name=value pairs joined with &. | Guide to application/x-www-form-urlencoded | |
| application/octet-stream | .bin | Arbitrary bytes: the type to use when no other fits. | Guide to application/octet-stream |
| application/pdf | A PDF document. | Guide to application/pdf | |
| application/zip | .zip | A ZIP archive. | Guide to application/zip |
| application/gzip | .gz | A gzip-compressed file. | |
| application/x-tar | .tar | A tar archive. | |
| application/x-7z-compressed | .7z | A 7-Zip archive. | |
| application/vnd.rar | .rar | A RAR archive. | |
| application/java-archive | .jar | A Java archive. | |
| application/wasm | .wasm | A WebAssembly module; streaming compilation requires this exact type. | |
| application/manifest+json | .webmanifest | A web app manifest. | |
| application/sql | .sql | SQL statements. | |
| application/rtf | .rtf | Rich Text Format. | |
| application/epub+zip | .epub | An EPUB e-book. | |
| application/msword | .doc | A Word document, the old binary format. | |
| application/vnd.openxmlformats-officedocument.wordprocessingml.document | .docx | A Word document. | |
| application/vnd.ms-excel | .xls | An Excel workbook, the old binary format. | |
| application/vnd.openxmlformats-officedocument.spreadsheetml.sheet | .xlsx | An Excel workbook. | |
| application/vnd.openxmlformats-officedocument.presentationml.presentation | .pptx | A PowerPoint presentation. | |
| application/vnd.oasis.opendocument.text | .odt | An OpenDocument text document. | |
| Multipart | |||
| multipart/form-data | Form fields and files in one body, split by a boundary. | Guide to multipart/form-data | |
| multipart/byteranges | Several byte ranges of one resource, in a 206 response. | ||
| multipart/mixed | Several parts of different types, as in email. | ||
| Image | |||
| image/png | .png | A PNG image. | |
| image/jpeg | .jpg .jpeg | A JPEG image. | |
| image/gif | .gif | A GIF image or animation. | |
| image/webp | .webp | A WebP image. | Guide to image/webp |
| image/avif | .avif | An AVIF image. | |
| image/svg+xml | .svg | An SVG vector image. | Guide to image/svg+xml |
| image/vnd.microsoft.icon | .ico | An icon file; image/x-icon is the older name most servers send. | |
| image/bmp | .bmp | A bitmap image. | |
| image/tiff | .tif .tiff | A TIFF image. | |
| image/heic | .heic | A HEIC image, the default photo format on iPhones. | |
| Audio | |||
| audio/mpeg | .mp3 | MP3 audio. | |
| audio/ogg | .ogg .oga | Ogg audio, usually Vorbis or Opus. | |
| audio/wav | .wav | WAV audio; some servers send audio/x-wav. | |
| audio/webm | .weba | WebM audio. | |
| audio/aac | .aac | AAC audio. | |
| audio/flac | .flac | FLAC lossless audio. | |
| audio/mp4 | .m4a | Audio in an MP4 container. | |
| Video | |||
| video/mp4 | .mp4 | MP4 video. | |
| video/webm | .webm | WebM video. | |
| video/ogg | .ogv | Ogg video. | |
| video/quicktime | .mov | QuickTime video. | |
| video/x-msvideo | .avi | AVI video. | |
| Font | |||
| font/woff2 | .woff2 | A WOFF2 web font, the format to serve today. | |
| font/woff | .woff | A WOFF web font. | |
| font/ttf | .ttf | A TrueType font. | |
| font/otf | .otf | An OpenType font. | |
Anatomy of the header
Content-Type: text/csv; charset=utf-8 is a type (text), a subtype (csv) and optional parameters after semicolons. Text types take a charset; multipart/form-data takes a boundary, the string that, after two dashes, separates its parts. Type and subtype are case-insensitive.
Content-Type and Accept
Content-Type says what this message's body is, in a request or a response. Accept says what the client wants back, with an optional preference: Accept: application/json, text/plain;q=0.5.
Sniffing and nosniff
Browsers may guess a type from the first bytes when the header is missing or vague. X-Content-Type-Options: nosniff stops that: scripts and stylesheets with the wrong type are then refused, which is what you want for user uploads.
When the type is wrong
Guides
- multipart/form-data Form fields and files in one body, split by a boundary.
- application/x-www-form-urlencoded Form fields as
name=valuepairs joined with&. - application/json JSON data.
- application/octet-stream Arbitrary bytes: the type to use when no other fits.
- text/plain Plain text, no markup.
- text/html An HTML document.
- text/csv Comma-separated values, one record per line.
- application/pdf A PDF document.
- image/svg+xml An SVG vector image.
- text/javascript JavaScript, scripts and modules alike.
- image/webp A WebP image.
- application/xml An XML document.
- text/event-stream Server-sent events: a stream of messages over one response.
- application/zip A ZIP archive.