Skip to content
Tutorials Center
My learning

Topics

HTML Reference ยท Characters and Codes

MIME Types for the Web

Common MIME types for web files: HTML, CSS, JavaScript, JSON, images, fonts, audio, video, documents and archives, with file extensions and usage notes.

A MIME type (officially a media type) is a short label that says what kind of data a file contains, such as text/html or image/png. Servers send it in the Content-Type HTTP header, and browsers use it, not the file extension, to decide how to handle a response.

TEXT
Content-Type: text/html; charset=utf-8
              ^^^^ ^^^^  ^^^^^^^^^^^^^
              type/subtype  optional parameter

In HTML you meet MIME types in attributes such as type on <source>, <link>, <object> and <embed>, and accept on <input type="file">:

HTML
<source src="clip.webm" type="video/webm">
<link rel="icon" href="/icon.svg" type="image/svg+xml">
<input type="file" accept="image/png, image/jpeg, .pdf">

Types are case-insensitive and have two parts: a top-level type (text, image, audio, video, font, application, multipart, model) and a subtype. A +json or +xml suffix means the format is built on JSON or XML.

Try it

The browser reports the MIME type of a file you pick, based on its extension. Nothing is uploaded.

What type is this file?

Web pages, styles and scripts

MIME type Extensions Notes
text/html .html, .htm HTML documents. Always send ; charset=utf-8.
application/xhtml+xml .xhtml XHTML parsed with the strict XML parser.
text/css .css Stylesheets. Browsers refuse to apply CSS sent with another type (in standards mode).
text/javascript .js, .mjs JavaScript, including modules. The official type; application/javascript is an obsolete alias that still works.
application/json .json JSON data.
application/ld+json .jsonld JSON-LD structured data, as in <script type="application/ld+json">.
application/manifest+json .webmanifest Web app manifests.
application/wasm .wasm WebAssembly modules. Required for streaming compilation.
application/xml, text/xml .xml Generic XML.
image/svg+xml .svg SVG images (also listed with images below).
application/rss+xml .rss RSS feeds.
application/atom+xml .atom Atom feeds.
text/plain .txt Plain text, shown as-is.
text/csv .csv Comma-separated values.
text/markdown .md Markdown source.
text/calendar .ics iCalendar events.
text/vcard .vcf Contact cards.
text/vtt .vtt WebVTT captions and subtitles for <track>.
text/event-stream โ€“ Server-sent events (EventSource).

Images

MIME type Extensions Notes
image/avif .avif Modern format with excellent compression; supported in all current browsers.
image/webp .webp Lossy and lossless with transparency; widely supported.
image/jpeg .jpg, .jpeg Photos. Note the type is jpeg, never jpg.
image/png .png Lossless with transparency; screenshots and graphics.
image/gif .gif Simple animations; 256 colors.
image/svg+xml .svg Scalable vector graphics.
image/x-icon, image/vnd.microsoft.icon .ico Favicons.
image/apng .apng Animated PNG.
image/bmp .bmp Uncompressed bitmaps; avoid on the web.
image/tiff .tif, .tiff Print and archiving; browsers (other than Safari) don't display it.
image/heic, image/heif .heic, .heif Phone camera photos; limited browser support.
image/jxl .jxl JPEG XL; limited browser support.

Fonts

MIME type Extensions Notes
font/woff2 .woff2 The best choice for web fonts.
font/woff .woff Older compressed web font format.
font/ttf .ttf TrueType.
font/otf .otf OpenType with CFF outlines.
font/collection .ttc Several fonts in one file.
application/vnd.ms-fontobject .eot Embedded OpenType, only for very old Internet Explorer.

Audio

MIME type Extensions Notes
audio/mpeg .mp3 MP3. Universal support.
audio/mp4 .m4a, .mp4 AAC audio in an MP4 container.
audio/aac .aac Raw AAC stream.
audio/ogg .ogg, .oga, .opus Ogg container, usually Vorbis or Opus.
audio/webm .weba, .webm WebM audio (Opus or Vorbis).
audio/wav .wav Uncompressed PCM; large files.
audio/flac .flac Lossless compression.
audio/midi .mid, .midi MIDI note data; browsers don't play it natively.

Video

MIME type Extensions Notes
video/mp4 .mp4, .m4v H.264, H.265 or AV1 video. The safest choice.
video/webm .webm VP8, VP9 or AV1 video.
video/ogg .ogv Theora video; mostly historical.
video/quicktime .mov Apple QuickTime; support varies.
video/mp2t .ts MPEG transport stream segments used in HLS.
application/vnd.apple.mpegurl .m3u8 HLS playlists.
application/dash+xml .mpd MPEG-DASH manifests.

Add a codecs parameter to type when a container can hold several codecs, so the browser can skip files it can't play: type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'.

Documents

MIME type Extensions Notes
application/pdf .pdf PDF; browsers show it in a built-in viewer.
application/rtf .rtf Rich Text Format.
application/msword .doc Legacy Word.
application/vnd.openxmlformats-officedocument.wordprocessingml.document .docx Word.
application/vnd.ms-excel .xls Legacy Excel.
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet .xlsx Excel.
application/vnd.ms-powerpoint .ppt Legacy PowerPoint.
application/vnd.openxmlformats-officedocument.presentationml.presentation .pptx PowerPoint.
application/vnd.oasis.opendocument.text .odt OpenDocument text.
application/vnd.oasis.opendocument.spreadsheet .ods OpenDocument spreadsheet.
application/vnd.oasis.opendocument.presentation .odp OpenDocument presentation.
application/epub+zip .epub E-books.

Archives and binary data

MIME type Extensions Notes
application/zip .zip ZIP archive.
application/gzip .gz Gzip-compressed file.
application/x-tar .tar Tar archive (not compressed).
application/x-7z-compressed .7z 7-Zip archive.
application/vnd.rar .rar RAR archive.
application/x-bzip2 .bz2 Bzip2-compressed file.
application/octet-stream any Arbitrary binary data. The default for unknown files; browsers download it instead of displaying it.

Form and multipart data

MIME type Where you see it Notes
application/x-www-form-urlencoded <form enctype> The default encoding for form submissions: name=Ana&city=Lisbon.
multipart/form-data <form enctype> Required when a form uploads files.
text/plain <form enctype> Human-readable but ambiguous; only for debugging.
multipart/byteranges HTTP responses Several byte ranges in one 206 Partial Content response.

Usage notes

  • The header decides, not the extension. A file named photo.png served as text/plain will not display as an image. Configure your server to send the right types.
  • Send X-Content-Type-Options: nosniff. It stops browsers from guessing ("sniffing") a different type than you sent, and makes them block scripts and styles with the wrong type, a protection against some attacks.
  • Use type on <source> to save bandwidth. The browser checks the type first and downloads only a format it supports.
  • accept is only a hint. It filters the file picker, but users can still choose other files, so always validate uploads on the server.
  • Leave out type on scripts and stylesheets. <script> and <link rel="stylesheet"> default to JavaScript and CSS. Use type="module" or type="importmap" only when you need them.