MIME types

A MIME type, also called a media type, tells the browser what kind of content it's receiving, through the Content-Type header. This cheat sheet brings together the types most common on websites, with the usual extension and a short note for each type, plus examples of setting the type on the server. You can search for a type or an extension, filter by topic, and copy with a click.

Pages, styles, and scripts

  • text/html

    Extensions: .html, .htm. HTML pages. It's common to send the type with the character encoding, so the browser correctly displays non-English text and special characters.

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

  • text/css

    Extension: .css. Stylesheets. On a regular page, a stylesheet sent with a different type isn't applied, and the page is displayed without its styles.

    Example: Content-Type: text/css; charset=utf-8

  • text/javascript

    Extensions: .js, .mjs. The recommended type for JavaScript files under RFC 9239, which lists application/javascript as an obsolete name. A module script sent without a JavaScript type is blocked by the browser.

    Example: Content-Type: text/javascript; charset=utf-8

  • text/plain

    Extension: .txt. Plain text, which the browser displays as is. It doesn't replace a dedicated type: a stylesheet sent as text/plain, for example, isn't recognized as a stylesheet.

    Example: Content-Type: text/plain; charset=utf-8

  • text/csv

    Extension: .csv. A table in text form, with commas separating the columns, for importing and exporting data (RFC 4180).

  • text/markdown

    Extension: .md. Text in Markdown syntax (RFC 7763). For this type, the charset parameter is required.

    Example: Content-Type: text/markdown; charset=utf-8

  • text/calendar

    Extension: .ics. An event or calendar in iCalendar format, which opens in the calendar on a phone or computer (RFC 5545).

  • text/vcard

    Extension: .vcf. A contact card in vCard format, which you can import into your contacts (RFC 6350).

Images

  • image/png

    Extension: .png. A lossless image, with support for transparent backgrounds.

  • image/jpeg

    Extensions: .jpg, .jpeg. The type for photos in JPEG format. The name image/jpg isn't registered, and the correct type is image/jpeg.

  • image/gif

    Extension: .gif. An image with up to 256 colors, mainly for short animations.

  • image/webp

    Extension: .webp. An image in WebP format, with good compression, transparency, and animation (RFC 9649).

  • image/avif

    Extension: .avif. An image in AVIF format, with especially efficient compression. Servers with an old type table may send it with a generic type. In that case, add a setting for it.

    Example: AddType image/avif .avif

  • image/svg+xml

    Extension: .svg. Vector graphics in XML syntax. An SVG file can contain scripts, so filter SVG files that visitors upload to the site.

  • image/vnd.microsoft.icon

    Extension: .ico. The type registered with IANA for icon files, such as favicon.ico.

  • image/x-icon

    Extension: .ico. A name not registered with IANA, but common in practice for icon files. This is the type set for the .ico extension in the type table that ships with Nginx.

  • image/apng

    Extension: .apng. An animated PNG image.

  • image/heic

    Extension: .heic. The photo format of iPhone devices. Browser support varies, so convert HEIC photos before uploading them to the site.

  • image/jxl

    Extension: .jxl. An image in JPEG XL format. Browser support varies, so don't rely on it as the only image format on the site.

  • image/tiff

    Extensions: .tif, .tiff. A high-quality image for printing and scanning. Most browsers don't display it.

Fonts

  • font/woff2

    Extension: .woff2. The recommended format for web fonts, with built-in compression. The font/ types were defined in RFC 8081.

    Example: AddType font/woff2 .woff2

  • font/woff

    Extension: .woff. The previous version of WOFF. The old name application/font-woff was deprecated in favor of font/woff.

  • font/ttf

    Extension: .ttf. A TrueType font. On a website, it's better to convert it to WOFF2, which loads faster.

  • font/otf

    Extension: .otf. An OpenType font. On a website, it's better to convert it to WOFF2.

  • font/collection

    Extension: .ttc. A collection of several fonts in one file.

Data, APIs, and forms

  • application/json

    Extension: .json. Data in JSON format, the most common type in APIs. Under RFC 8259, JSON exchanged between systems is encoded in UTF-8, and no charset parameter is defined for this type.

    Example: Content-Type: application/json

  • application/ld+json

    Extension: .jsonld. Structured data in JSON-LD format, for example Schema.org data in a script tag on the page.

    Example: <script type="application/ld+json">

  • application/problem+json

    A detailed API error response under RFC 9457, with fields such as type, title, and status.

  • application/xml

    Extension: .xml. An XML document. This is the recommended type under RFC 7303.

  • text/xml

    Extension: .xml. A registered type for XML that's still common, and the type set for the .xml extension in the type table that ships with Nginx.

  • application/rss+xml

    Extension: .rss. An RSS feed. A name not registered with IANA, but very common in practice, and it appears in the Nginx type table.

  • application/atom+xml

    Extension: .atom. A feed of updates in Atom format (RFC 4287).

  • application/manifest+json

    Extension: .webmanifest. The manifest file of a site that can be installed as an app. Many servers don't recognize the extension, so add a setting for it.

    Example: AddType application/manifest+json .webmanifest

  • application/wasm

    Extension: .wasm. WebAssembly code. Loading with WebAssembly.instantiateStreaming fails when the file isn't sent with this type.

  • application/yaml

    Extensions: .yaml, .yml. Configuration and data files in YAML syntax (RFC 9512).

  • application/sql

    Extension: .sql. A file of SQL statements, for example a database backup (RFC 6922). A file like this shouldn't be in the site's public folder.

  • application/x-www-form-urlencoded

    No extension. The default type for submitting an HTML form: the fields are sent as name and value pairs, separated by the & character.

    Example: name=Dana&city=Haifa

  • multipart/form-data

    No extension. Submits a form in separate parts, which file uploads require. In the form, set enctype="multipart/form-data" (RFC 7578).

    Example: Content-Type: multipart/form-data; boundary=----abc123

  • multipart/byteranges

    No extension. A response with several ranges of the same file, together with the status 206 Partial Content.

Audio and video

  • video/mp4

    Extension: .mp4. The most common format for videos on websites, supported in all browsers.

  • video/webm

    Extension: .webm. Video in WebM format for websites. A name not registered with IANA, but common in practice and supported in most browsers.

  • video/ogg

    Extension: .ogv. Video in Ogg format.

  • video/quicktime

    Extension: .mov. Video in QuickTime format, common in iPhone recordings. Not all browsers display it, so convert it to MP4 before uploading.

  • video/matroska

    Extension: .mkv. Video in Matroska format, registered in RFC 9559. Browser support is partial.

  • audio/mpeg

    Extension: .mp3. Audio in MP3 format. The name audio/mp3 isn't registered, and the correct type is audio/mpeg.

  • audio/mp4

    Extension: .m4a. Audio in an MP4 file, usually in AAC format.

  • audio/aac

    Extension: .aac. Audio in AAC format.

  • audio/ogg

    Extensions: .ogg, .oga, .opus. Audio in an Ogg file, in Vorbis or Opus format.

  • audio/flac

    Extension: .flac. Lossless audio (RFC 9639).

  • audio/wav

    Extension: .wav. Audio, usually uncompressed. A name not registered with IANA, but common in practice.

  • audio/webm

    Extension: .weba. Audio in a WebM file. A name not registered with IANA, but common in practice.

Downloads, documents, and archives

  • application/octet-stream

    Any extension. A binary file of unknown type. The browser doesn't display a file like this, and usually offers to save it.

  • application/pdf

    Extension: .pdf. A PDF document, which most browsers display directly. To download it instead of displaying it, add Content-Disposition: attachment.

  • application/zip

    Extension: .zip. A ZIP archive.

  • application/gzip

    Extension: .gz. A file compressed with gzip (RFC 6713). Don't confuse it with Content-Encoding: gzip, which indicates compression during transfer, not the file type.

  • application/x-tar

    Extension: .tar. A TAR archive. A name not registered with IANA, but common in practice.

  • application/x-7z-compressed

    Extension: .7z. A 7-Zip archive. A name not registered with IANA, but common in practice.

  • application/vnd.rar

    Extension: .rar. A RAR archive.

  • application/zstd

    Extension: .zst. A file compressed with Zstandard (RFC 8878).

  • application/msword

    Extension: .doc. A Word document in the old format.

  • application/vnd.openxmlformats-officedocument.wordprocessingml.document

    Extension: .docx. A Word document in the current format.

  • application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

    Extension: .xlsx. An Excel spreadsheet in the current format.

  • application/epub+zip

    Extension: .epub. An ebook in EPUB format.

Setting the type on the server

  • AddType application/manifest+json .webmanifest

    In an .htaccess file: maps a type to an extension. You can list several extensions on one line, with or without a leading dot. Works when the server allows FileInfo settings in .htaccess.

    Example: AddType font/woff2 .woff2

  • AddType text/javascript .js .mjs

    In an .htaccess file: sends scripts and modules with the recommended JavaScript type. Useful when the server doesn't recognize the .mjs extension.

  • AddDefaultCharset UTF-8

    In an .htaccess file: adds charset=UTF-8 to text/html and text/plain responses only. Use it only when all of these files are saved in UTF-8.

  • AddCharset UTF-8 .css .js

    In an .htaccess file: adds the character encoding to the type of other extensions, such as stylesheets and scripts.

  • ForceType application/octet-stream

    In a folder's .htaccess file: all static files in the folder are sent with this type and offered for download, regardless of their extension. ForceType None in a subfolder restores the normal mapping.

  • <FilesMatch "\.(pdf|zip)$"> Header set Content-Disposition "attachment" </FilesMatch>

    In an .htaccess file: the browser downloads PDF and ZIP files instead of opening them. The Header directive requires the mod_headers module.

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

    In Nginx, in the http block: loads the type table that ships with Nginx, and sets a type for extensions that aren't in the table. Without default_type, the default is text/plain.

  • location ~* \.webmanifest$ { types { } default_type application/manifest+json; }

    In Nginx: the empty types block cancels the extension mapping in this location, and default_type sets the type for all files in it. This is how you set a type for an extension that's missing from the table.

  • location /download/ { types { } default_type application/octet-stream; }

    In Nginx: all files in the folder are sent as binary files and offered for download. This is the example shown in the Nginx documentation.

  • location /files/ { add_header Content-Disposition "attachment"; }

    In Nginx: the browser downloads the files instead of opening them. By default, a block that has its own add_header doesn't inherit the add_header directives from the level above it.

  • charset utf-8; charset_types text/css text/xml text/plain application/javascript;

    In Nginx: adds charset=utf-8 to text/html responses and to the types in charset_types. The setting replaces the default charset_types list, so include all the types you need in it.

  • Header always set X-Content-Type-Options "nosniff"

    In an .htaccess file: the browser doesn't guess the file type, and it blocks a stylesheet that isn't text/css and a script that isn't a JavaScript type. Turn it on only after every type on the site is set correctly. The example shows the same header in Nginx.

    Example: add_header X-Content-Type-Options "nosniff" always;

Old and nonstandard names

  • application/javascript

    The previous name for the JavaScript type, marked obsolete in favor of text/javascript. All browsers still accept it, and the Nginx type table sends the .js extension with it.

  • text/ecmascript

    An old name for JavaScript, marked obsolete in RFC 9239 together with application/ecmascript. Use text/javascript.

  • application/font-woff

    The old name for WOFF fonts, deprecated in RFC 8081. Use font/woff and font/woff2.

  • application/x-gzip

    A nonstandard name for .gz files, which Windows and macOS sometimes send when uploading files. A script that checks uploaded files usually accepts both this name and application/gzip.

  • application/x-zip-compressed

    A nonstandard name for .zip files, which Windows sometimes sends when uploading files. A script that checks uploaded files usually accepts both this name and application/zip.

How a MIME type is built

A MIME type has two parts, a type and a subtype, with a slash between them, for example image/png. After a semicolon, you can add a parameter, such as the character encoding in text/html; charset=utf-8. The names are case-insensitive, and they're usually written in lowercase. A suffix such as +json or +xml at the end of the subtype indicates the syntax the format is based on, and the vnd. prefix indicates a vendor-specific type.

The official list of types is maintained by IANA, under the rules of RFC 6838. Some common names, mainly those that start with x-, aren't registered there, and on this page they're marked as names not registered with IANA but common in practice. A list of extensions by file type, with an explanation of each format, is on the file extensions page.

What happens when the type is wrong

The server sets the type based on the file extension and sends it in the Content-Type header, and the browser uses it to decide what to do with the file. A stylesheet sent with a type other than text/css isn't applied to the page, a module script sent without a JavaScript type doesn't run, and loading WebAssembly with instantiateStreaming fails when the file isn't sent as application/wasm. Compression and caching rules on the server are also sometimes set by type, such as the gzip_types directive in Nginx.

The X-Content-Type-Options: nosniff header stops the browser from guessing the type, so it exposes any wrong type right away. You'll find an explanation of this header and other headers on the HTTP headers page, and you can check the headers your site actually sends with the HTTP header analyzer tool.

Displaying in the browser or downloading

The Content-Type header sets the file type, and the Content-Disposition header sets whether to display it. The value inline, the default, displays the file in the browser when the browser can display it, and the value attachment downloads it with a save dialog. The filename parameter sets the suggested file name, and for a name with non-English characters, you also add filename* encoded in UTF-8. You'll find more server configuration examples in the .htaccess cheat sheet and the Nginx cheat sheet.

Did you know?

With our web hosting plans, you manage your site's files from the file manager in the control panel, and with our Linux hosting plans, you can set a type for an extension with AddType in your site's .htaccess file.

Web hosting plans

MIME types FAQ

What is a MIME type, and why does it matter for my website?

A MIME type, also called a media type, is the name the server sends to the browser in the Content-Type header to say what a file contains, for example text/html for a page or image/webp for an image. The browser uses it to decide whether to display the file, apply it as a stylesheet, run it as a script, or download it. When every type on your site is set correctly, your pages load properly in every browser.

What's the correct type for JavaScript files?

The recommended type is text/javascript, for both .js files and modules in .mjs files. RFC 9239 lists application/javascript as an obsolete name, but browsers still accept it, so a site that sends it keeps working.

How do I add a MIME type for an extension the server doesn't recognize?

In an .htaccess file, add a line such as AddType application/manifest+json .webmanifest. In Nginx, add the type to the type table, or set it in a suitable location with types and default_type. After the change, check the Content-Type header in the response, for example with the HTTP header analyzer tool.

How do I make a PDF file download instead of opening in the browser?

Send the Content-Disposition: attachment header with the file, and you can add the suggested file name to it in the filename parameter. The type stays application/pdf, so the file is saved with the correct extension and opens in the right program.

Are MIME types case-sensitive?

No. The type and subtype names are case-insensitive, so Text/HTML and text/html are the same. They're usually written in lowercase. The values of some parameters can be case-sensitive.

Shopping cart

Your cart is emptyYou can start with one of our popular plans.

Site search

Accessibility

Text size
100%
Accessibility statement