DeveloperInformationEducationUtility

MIME Type Reference

Look up the correct MIME type for any file extension. Searchable reference of media types for images, audio, video, fonts, documents, archives, and code, with practical serving notes.

ExtensionMIME typeFormatNote
Text & markup · 11
.html.htmHTML documentAlways send charset=utf-8; browsers sniff legacy encodings otherwise.
.cssCascading style sheetMust be text/css or the stylesheet is ignored in strict mode.
.txt.text .logPlain textDefault fallback for unknown text; add charset.
.csvComma-separated valuesAdd Content-Disposition: attachment to force a download.
.tsv.tabTab-separated valuesRegistered separately from text/csv.
.md.markdownMarkdownRFC 7763; optional variant parameter, e.g. ;variant=GFM.
.ics.ifbiCalendarTriggers calendar import on most desktop and mobile clients.
.vcf.vcardvCard contactOlder servers still use text/x-vcard.
.rtfRich Text Formattext/rtf also appears in the wild; application/rtf is registered.
.vttWebVTT subtitlesRequired exactly for <track> to load; CORS applies.
.srtSubRip subtitlesUnregistered; convert to WebVTT for browser playback.
Image · 12
.pngPortable Network GraphicsAlready compressed — skip gzip/brotli.
.jpg.jpeg .jpeJPEG imageNever image/jpg — that type does not exist.
.gifGraphics Interchange FormatAnimated GIFs are far larger than equivalent WebP/AVIF video.
.webpWebP imageUniversally supported since 2020; good default for photos and UI art.
.avifAVIF imageBest compression of the mainstream formats; serve behind <picture>.
.svg.svgzScalable Vector GraphicsXML text — compresses very well, but sanitize user uploads (embedded scripts).
.icoIcon fileimage/x-icon is the widely-served legacy alias.
.bmpWindows bitmapUncompressed; almost always worth converting before serving.
.tif.tiffTIFF imageNot rendered by browsers — download or convert server-side.
.heic.heifHEIC / HEIF imageDefault iPhone photo format; Safari-only in browsers.
.apngAnimated PNGServed as image/apng so browsers do not treat it as a still PNG.
.jxlJPEG XLLimited browser support; keep a WebP/JPEG fallback.
Audio · 9
.mp3MP3 audioaudio/mp3 is a non-standard alias some clients still send.
.wavWaveform audioaudio/x-wav and audio/wave appear in older stacks.
.ogg.ogaOgg audioUse application/ogg only when the stream mixes audio and video.
.opusOpus audioAdd the codecs parameter: audio/ogg; codecs=opus.
.m4aMPEG-4 audioaudio/x-m4a is the common legacy spelling.
.aacAAC audioRaw ADTS stream; inside an MP4 container use audio/mp4.
.flacFLAC lossless audioSupported by every current browser.
.webaWebM audioAudio-only WebM, usually Opus or Vorbis.
.mid.midiMIDI sequenceaudio/x-midi is also registered as an alias.
Video · 9
.mp4.m4vMPEG-4 videoSafest default; add codecs for MSE, e.g. video/mp4; codecs="avc1.42E01E".
.webmWebM videoVP8/VP9/AV1; not supported in older Safari.
.ogvOgg Theora videoLargely superseded by WebM.
.mov.qtQuickTime movieOften plays in Safari only; remux to MP4 for the web.
.aviAVI containerNo native browser playback.
.mkvMatroska videoUnregistered x- type; remux for browser delivery.
.ts.m2tsMPEG transport streamHLS segment format — note the .ts extension collides with TypeScript.
.m3u8HLS playlistapplication/x-mpegURL is the common alternative spelling.
.mpdMPEG-DASH manifestServe with CORS headers for cross-origin players.
Font · 5
.woff2WOFF 2.0 web fontPre-compressed — never gzip again. The only format modern sites need.
.woffWOFF web fontLegacy fallback; also pre-compressed.
.ttfTrueType fontCompresses well with brotli, but ship WOFF2 instead.
.otfOpenType fontapplication/x-font-otf is the deprecated legacy type.
.eotEmbedded OpenTypeIE-only; safe to drop from modern @font-face stacks.
Document · 11
.pdfPortable Document FormatContent-Disposition decides inline viewing vs. download.
.doc.dotWord 97–2003Legacy binary OLE format.
.docxWord (OOXML)A ZIP container — the longest MIME type you will meet in practice.
.xls.xltExcel 97–2003Legacy binary spreadsheet.
.xlsxExcel (OOXML)Preferred over text/csv when formatting matters.
.ppt.ppsPowerPoint 97–2003Legacy binary presentation.
.pptxPowerPoint (OOXML)ZIP-based OOXML presentation.
.odtOpenDocument textLibreOffice / OpenOffice document.
.odsOpenDocument spreadsheetOpenDocument equivalent of .xlsx.
.odpOpenDocument presentationOpenDocument equivalent of .pptx.
.epubEPUB e-bookZIP container with XHTML content.
Archive · 8
.zipZIP archiveAlready compressed; disable transfer compression.
.gz.gzipgzip archiveFor .tar.gz prefer application/gzip over the old x- forms.
.tartar archiveUncompressed container; compresses very well.
.bz2bzip2 archiveSlower than gzip, smaller output.
.7z7-Zip archiveNot registered with IANA.
.rarRAR archiveapplication/x-rar-compressed is the older spelling.
.xzXZ archiveLZMA2 compression, common for source tarballs.
.zstZstandard archiveAlso a Content-Encoding value (zstd) on modern servers.
Data & code · 16
.jsonJSONAlways UTF-8 by spec — do not add a charset parameter.
.jsonldJSON-LDThe type search engines expect for structured data blocks.
.ndjson.jsonlNewline-delimited JSONStreaming-friendly; one JSON value per line.
.xmlXMLtext/xml is legacy and defaults to US-ASCII — prefer application/xml.
.yaml.ymlYAMLRegistered in 2024; text/yaml is the older de-facto type.
.tomlTOML configCommon for Rust and Python packaging config.
.js.mjs .cjsJavaScripttext/javascript is the standard type; application/javascript is obsolete.
.wasmWebAssembly moduleRequired exactly for streaming instantiation to work.
.mapSource mapPlain JSON; usually blocked from public access in production.
.rssRSS feedReaders also accept application/xml.
.atomAtom feedThe IETF-standardised alternative to RSS.
.webmanifestWeb app manifestPWA install prompts require this exact type.
.sqlSQL scripttext/plain is a safe fallback for browser viewing.
.sh.bashShell scriptServe as text/plain if you want it viewed, not run.
.pyPython sourceapplication/x-python-code refers to compiled bytecode.
.parquetApache ParquetRegistered in 2024; columnar analytics format.
Binary · 10
.bin.datArbitrary binary dataThe universal fallback — always triggers a download.
File upload form bodyRequired for <form enctype> when uploading files.
URL-encoded form bodyDefault HTML form encoding; unsuitable for binary payloads.
Server-sent eventsDisable proxy buffering or events arrive in bursts.
.apkAndroid packageZIP-based; served for sideloaded installs.
.exe.msi .dllWindows executableapplication/x-msdownload is the legacy type.
.dmgmacOS disk imageUnregistered but universally understood.
.isoISO disc imageLarge files — make sure range requests are enabled.
.torrentBitTorrent metainfoHanded off to the OS torrent client.
.swfFlash movieDead format — kept here for legacy archive work.

What a MIME type actually does

A MIME type — officially a media type — is the short string a server puts in the Content-Type response header to tell the client what it just received. The file extension is a hint for humans and for the operating system; the media type is what the browser actually obeys.

Every type has the form type/subtype, optionally followed by parameters: text/html; charset=utf-8. The top-level type is one of a small fixed set — text, image, audio, video, font, model, application, plus the composite multipart and message. The subtype identifies the exact format, and IANA maintains the official registry.

Get it wrong and behaviour breaks in ways that look unrelated to the header: a stylesheet served as text/plain is silently ignored, a WebAssembly module served as octet-stream cannot stream-instantiate, and a PWA manifest with the wrong type never triggers an install prompt.

Prefixes: what x-, vnd., and + mean

PatternMeaningExample
x-Unregistered / experimental. Deprecated by RFC 6648 but still everywhere in legacy configs.application/x-7z-compressed
vnd.Vendor tree — a format owned by a specific company or product.application/vnd.ms-excel
prs.Personal tree — formats registered by individuals rather than organisations.text/prs.lines.tag
+xml, +json, +zipStructure suffix — the format is built on top of that base syntax, so generic parsers can still read it.image/svg+xml · application/epub+zip
; charset=Encoding parameter. Required for text types; forbidden for application/json, which is UTF-8 by definition.text/html; charset=utf-8
; codecs=Media parameter naming the exact codecs in the container — needed by Media Source Extensions.video/mp4; codecs="avc1.42E01E"

Types people get wrong

  • image/jpg does not exist. The registered type for a .jpg file is image/jpeg. Some servers accept the wrong one; treat that as luck, not spec.
  • JavaScript is text/javascript. The HTML spec settled on it and marked application/javascript obsolete — the opposite of the advice that circulated for a decade.
  • JSON takes no charset. application/json; charset=utf-8 is not wrong so much as meaningless; the spec fixes the encoding at UTF-8.
  • application/xml beats text/xml. The legacy text/xml defaults to US-ASCII when no charset is given, which mangles non-English content.
  • Fonts moved out of application/. RFC 8081 created the font/ top-level type, so font/woff2 replaced application/font-woff2.
  • .ts is ambiguous. On a web server it means an MPEG transport stream (video/mp2t); in a source tree it means TypeScript. Build tools and CDNs regularly disagree.

Sniffing, downloads, and security

When a browser distrusts or lacks a Content-Type it falls back to MIME sniffing— inspecting the first bytes to guess the format. That is a real attack surface: a user-uploaded file declared as an image but sniffed as HTML can execute script on your origin. Sending X-Content-Type-Options: nosniff turns sniffing off and makes the declared type binding.

The media type decides what the file is; Content-Disposition decides what to do with it. inline renders in the tab where possible, attachment; filename="report.pdf" forces a save dialog. A PDF served as octet-stream downloads not because of the type alone but because the browser has no viewer for that type.

Rule of thumb for uploads

Never trust the Content-Type a client sends with an upload, and never derive it from the filename. Detect the type from the file's magic bytes server-side, compare it against an allowlist, and re-serve it with a type you chose — from a separate domain if the files are public.

Where the mapping lives on a real server

Nginx

Reads /etc/nginx/mime.types, included from the http block.

include       mime.types;
default_type  application/octet-stream;

Apache

Ships mime.types; extend it per-directory.

AddType application/wasm .wasm
AddType font/woff2 .woff2

Node / Express

Set it explicitly when you build the response yourself.

res.type("application/json");
res.setHeader("X-Content-Type-Options", "nosniff");

Checking what you actually send

The header is the only source of truth — read it, don't assume it.

curl -sI https://example.com/app.wasm \
  | grep -i content-type