Skip to content
DDevToolery

MIME types

A MIME type tells the browser how to treat bytes. Get it wrong and a download becomes a page render, a script fails to execute, or a font is rejected. When in doubt, serve application/octet-stream and let the browser download it.

20 entries

Text and markup

ExtensionMIME typeNotes
.htmltext/htmlAlways add ; charset=utf-8
.csstext/cssRejected if served as text/plain
.jstext/javascriptThe standard type; application/javascript is obsolete
.jsonapplication/jsonNo charset parameter is defined — UTF-8 is assumed
.csvtext/csv
.mdtext/markdown
.xmlapplication/xmltext/xml is also registered but discouraged
.yamlapplication/yamlRegistered in 2024; text/yaml was common before

Images

ExtensionMIME typeNotes
.pngimage/png
.jpgimage/jpegNot image/jpg — that type does not exist
.svgimage/svg+xmlCan contain scripts; never serve user uploads inline
.webpimage/webp
.avifimage/avif
.icoimage/x-iconimage/vnd.microsoft.icon is the registered form

Fonts, archives and binaries

ExtensionMIME typeNotes
.woff2font/woff2
.pdfapplication/pdf
.zipapplication/zip
.gzapplication/gzip
.wasmapplication/wasmRequired exactly for streaming compilation
(any)application/octet-streamUnknown bytes. Triggers a download.

Browsers may sniff content when the type looks wrong. Send X-Content-Type-Options: nosniff to stop them guessing.