正在加载,请稍候…

MIME Types Cheat Sheet: Common Content-Type Values by Extension

A quick MIME types reference — the Content-Type values for common file extensions (json, html, png, pdf, fonts, video) and how charset and the octet-stream fallback work.

What a MIME Type Is

A MIME type (media type) tells the client what kind of data a response body contains. It rides in the Content-Type header as type/subtype, optionally with parameters:

Content-Type: text/html; charset=utf-8

Browsers use it to decide whether to render, download, or parse a response — getting it wrong is a common cause of "the browser downloaded my page instead of showing it."

Text and Web

Extension MIME type
.html text/html
.css text/css
.js / .mjs text/javascript
.json application/json
.xml application/xml
.csv text/csv
.txt text/plain
.md text/markdown

Images

Extension MIME type
.png image/png
.jpg / .jpeg image/jpeg
.gif image/gif
.webp image/webp
.svg image/svg+xml
.avif image/avif
.ico image/x-icon

Documents, Archives, Fonts

Extension MIME type
.pdf application/pdf
.zip application/zip
.gz application/gzip
.woff2 font/woff2
.woff font/woff
.ttf font/ttf

Audio and Video

Extension MIME type
.mp3 audio/mpeg
.wav audio/wav
.mp4 video/mp4
.webm video/webm
.ogg audio/ogg

charset and the Fallback

  • charset=utf-8 matters for text types so the browser decodes bytes correctly. It's meaningless for binary types like images.
  • application/octet-stream is the "unknown binary" fallback. Servers send it when they can't determine the type — and browsers usually download rather than render it.
  • Serving JavaScript or CSS with the wrong type can make strict browsers refuse to execute it, so match the extension to the table above.

Frequently Asked Questions

What is the MIME type for JSON? application/json. It has no charset parameter because JSON is always UTF-8 by specification.

What is the Content-Type for JavaScript? text/javascript is the current standard. The older application/javascript still works but text/javascript is preferred.

What does application/octet-stream mean? It's the generic "arbitrary binary data" type used when the real type is unknown; browsers typically download it instead of rendering.

Look up the type for any extension with the MIME types tool, and read the full reference in the MIME Types Guide.