Find the media type for an extension, with the charset rules that catch people out and whether gzip is worth applying to it.
32 media types
Search by extension, by type, or by what it is.
Serving a file with the wrong type is how a stylesheet gets ignored and a download opens as a wall of text. WithX-Content-Type-Options: nosniffset, the browser believes you rather than guessing.
application/jsoncompressibleData · .json
JSON. The default for APIs.
No charset parameter is defined — JSON is UTF-8 by specification. Adding one is redundant but harmless.
application/ld+jsoncompressibleData · .jsonld
JSON-LD, for linked data and structured markup.
application/x-ndjsoncompressibleData · .ndjson
Newline-delimited JSON, one object per line. Streamable in a way a JSON array is not.
application/xmlcompressibleData · .xml
XML intended for machines. `text/xml` is the human-readable variant, and the distinction is largely historical.
application/yamlcompressibleData · .yaml, .yml
YAML. Registered only in 2024; `text/yaml` and `application/x-yaml` are still common.
text/csvcompressibleData · .csv
Comma-separated values.
Take the charset seriously here — a CSV of names in the wrong encoding is the classic mojibake bug.
application/pdfalready compressedDocument · .pdf
PDF.
application/zipalready compressedArchive · .zip
ZIP archive.
application/gzipalready compressedArchive · .gz
A gzip file, as content — not to be confused with `Content-Encoding: gzip`, which compresses a body of some other type.
application/octet-streamalready compressedBinary · .bin
Arbitrary bytes. The fallback when nothing is known.
With `Content-Disposition: attachment`, this is how you force a download of something a browser would otherwise render.
application/javascriptcompressibleCode · .js, .mjs
JavaScript. `text/javascript` is now the preferred spelling, after years of the reverse.
text/htmlcompressibleDocument · .html, .htm
HTML.
Always send `; charset=utf-8`. Without it a browser may sniff, and the result depends on the content.
text/csscompressibleCode · .css
CSS.
text/plaincompressibleText · .txt, .text
Plain text.
Defaults to US-ASCII in older specifications, so send the charset explicitly.
text/markdowncompressibleText · .md, .markdown
Markdown.
text/event-streamalready compressedStreaming
Server-sent events.
Must not be buffered or compressed by an intermediary, or events arrive in batches instead of as they happen.
image/pngalready compressedImage · .png
PNG. Lossless.
image/jpegalready compressedImage · .jpg, .jpeg
JPEG. Lossy.
image/webpalready compressedImage · .webp
WebP. Lossy or lossless, smaller than both above.
image/avifalready compressedImage · .avif
AVIF. Smaller again, slower to encode.
image/svg+xmlcompressibleImage · .svg
SVG. XML, so it compresses well — and it can contain script, so it is not safe to serve from a domain holding sessions.
image/gifalready compressedImage · .gif
GIF.
image/x-iconalready compressedImage · .ico
Favicon. `image/vnd.microsoft.icon` is the registered name nobody uses.
font/woff2already compressedFont · .woff2
WOFF2. Already Brotli-compressed internally.
font/woffalready compressedFont · .woff
WOFF. Superseded by WOFF2.
audio/mpegalready compressedAudio · .mp3
MP3.
video/mp4already compressedVideo · .mp4, .m4v
MP4.
video/webmalready compressedVideo · .webm
WebM.
application/x-www-form-urlencodedcompressibleForm
HTML form encoding — percent-encoded key=value pairs, like a query string.
Cannot carry binary. A file upload needs multipart/form-data.
multipart/form-dataalready compressedForm
Form submission with file uploads.
The `boundary` parameter is mandatory and must not appear in any part. Let your HTTP client set this header — a hand-written boundary that collides with the body produces a corrupt request.
application/problem+jsoncompressibleData
RFC 9457 problem details — the standard shape for an API error body.
application/wasmcompressibleCode · .wasm
WebAssembly. Must be served with this type for streaming compilation to work.
MIME Type Lookup runs entirely on your device — nothing is uploaded.
You’re on the Free plan. Compare plans
The compressible column is the one that earns this a page. Gzipping a PNG, a WOFF2 or an MP4 spends CPU to make the file very slightly larger, because all three are already compressed internally. It is invisible until someone profiles the server, and it is in every default configuration that compresses by extension rather than by type.
The charset notes cover the traps. `application/json` has no charset parameter defined at all, because JSON is specified as UTF-8 — adding one is redundant and harmless. `text/plain` defaults to US-ASCII in older specifications, so it genuinely needs one. `text/csv` needs it taken seriously, since a CSV of names in the wrong encoding is the classic mojibake bug.
`multipart/form-data` has a mandatory boundary parameter that must not appear anywhere in the body. That is why you should let your HTTP client set the header rather than writing it by hand — a hand-written boundary that collides with the content produces a corrupt request that is very hard to diagnose.
Serving a file with the wrong type is how a stylesheet gets ignored and a download opens as a wall of text in the browser. With `X-Content-Type-Options: nosniff` set, the browser believes your declared type instead of guessing, which makes getting it right matter more rather than less.
It is not defined for that type — JSON is specified as UTF-8, so a charset parameter is redundant. Adding `; charset=utf-8` is harmless and some tooling expects it; leaving it off is correct.
Text-shaped ones: HTML, CSS, JavaScript, JSON, SVG, CSV. Not PNG, JPEG, WebP, MP4, WOFF2 or ZIP — those are already compressed, and running gzip over them costs CPU and usually adds a few bytes.
`text/javascript` is now the preferred spelling, after years of `application/javascript` being recommended. Both work everywhere; the HTML specification settled on the first.
Usually `Content-Disposition: attachment`, or a media type the browser has no renderer for — `application/octet-stream` will always download. Serving the right type is what makes the browser display it.
`X-Content-Type-Options: nosniff` stops the browser guessing a type other than the one you declared. It closes a real attack where an uploaded file is sniffed as HTML and executed — and it means a wrong Content-Type now breaks the page rather than being silently corrected.