MIME 类型对照表
MIME 类型(Multipurpose Internet Mail Extensions)是互联网标准中用于标识文件内容类型的标识符,在 HTTP 的 Content-Type 头部中使用。
| MIME Type | 扩展名 | 分类 | 说明 |
|---|---|---|---|
| text/html | .html | Text | HTML 文档 |
| text/css | .css | Text | CSS 样式表 |
| text/javascript | .js | Text | JavaScript 脚本 |
| text/plain | .txt | Text | 纯文本 |
| text/xml | .xml | Text | XML 文档 |
| text/csv | .csv | Text | CSV 逗号分隔值 |
| text/markdown | .md | Text | Markdown 文档 |
| application/json | .json | Application | JSON 数据 |
| application/xml | .xml | Application | XML 数据 |
| application/pdf | Application | PDF 文档 | |
| application/zip | .zip | Application | ZIP 压缩包 |
| application/gzip | .gz | Application | Gzip 压缩文件 |
| application/x-tar | .tar | Application | Tar 归档文件 |
| application/octet-stream | .bin | Application | 二进制数据流 |
| application/x-www-form-urlencoded | - | Application | 表单编码数据 |
| multipart/form-data | - | Application | 多部分表单数据(文件上传) |
| image/jpeg | .jpg | Image | JPEG 图片 |
| image/png | .png | Image | PNG 图片 |
| image/gif | .gif | Image | GIF 动图 |
| image/svg+xml | .svg | Image | SVG 矢量图 |
| image/webp | .webp | Image | WebP 图片 |
| image/x-icon | .ico | Image | 图标文件 |
| image/bmp | .bmp | Image | BMP 位图 |
| audio/mpeg | .mp3 | Audio | MP3 音频 |
| audio/wav | .wav | Audio | WAV 音频 |
| audio/ogg | .ogg | Audio | OGG 音频 |
| audio/aac | .aac | Audio | AAC 音频 |
| video/mp4 | .mp4 | Video | MP4 视频 |
| video/webm | .webm | Video | WebM 视频 |
| video/x-msvideo | .avi | Video | AVI 视频 |
| font/woff | .woff | Font | WOFF 字体 |
| font/woff2 | .woff2 | Font | WOFF2 字体 |
| font/ttf | .ttf | Font | TrueType 字体 |
| font/otf | .otf | Font | OpenType 字体 |
常见问题
什么是 MIME 类型?
MIME 类型(Content-Type)标识文件或数据的格式,由"类型/子类型"组成(如 text/html),服务器通过 HTTP 响应头告知浏览器如何解析。
扩展名和 MIME 类型必须一致吗?
不一定。浏览器以 Content-Type 响应头为准,扩展名只是约定。配置错误可能导致被下载或安全拦截。
文件上传该用哪个 MIME?
含文件的表单使用 multipart/form-data;纯键值表单使用 application/x-www-form-urlencoded。
如何查看资源的 MIME 类型?
在浏览器开发者工具的 Network 面板查看响应头 Content-Type,或用本站的请求/响应解析相关工具核对。