MIME types
Pages, styles, and scripts
-
text/htmlExtensions: .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/cssExtension: .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/javascriptExtensions: .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/plainExtension: .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/csvExtension: .csv. A table in text form, with commas separating the columns, for importing and exporting data (RFC 4180).
-
text/markdownExtension: .md. Text in Markdown syntax (RFC 7763). For this type, the charset parameter is required.
Example:
Content-Type: text/markdown; charset=utf-8 -
text/calendarExtension: .ics. An event or calendar in iCalendar format, which opens in the calendar on a phone or computer (RFC 5545).
-
text/vcardExtension: .vcf. A contact card in vCard format, which you can import into your contacts (RFC 6350).
Images
-
image/pngExtension: .png. A lossless image, with support for transparent backgrounds.
-
image/jpegExtensions: .jpg, .jpeg. The type for photos in JPEG format. The name image/jpg isn't registered, and the correct type is image/jpeg.
-
image/gifExtension: .gif. An image with up to 256 colors, mainly for short animations.
-
image/webpExtension: .webp. An image in WebP format, with good compression, transparency, and animation (RFC 9649).
-
image/avifExtension: .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+xmlExtension: .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.iconExtension: .ico. The type registered with IANA for icon files, such as favicon.ico.
-
image/x-iconExtension: .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/apngExtension: .apng. An animated PNG image.
-
image/heicExtension: .heic. The photo format of iPhone devices. Browser support varies, so convert HEIC photos before uploading them to the site.
-
image/jxlExtension: .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/tiffExtensions: .tif, .tiff. A high-quality image for printing and scanning. Most browsers don't display it.
Fonts
-
font/woff2Extension: .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/woffExtension: .woff. The previous version of WOFF. The old name application/font-woff was deprecated in favor of font/woff.
-
font/ttfExtension: .ttf. A TrueType font. On a website, it's better to convert it to WOFF2, which loads faster.
-
font/otfExtension: .otf. An OpenType font. On a website, it's better to convert it to WOFF2.
-
font/collectionExtension: .ttc. A collection of several fonts in one file.
Data, APIs, and forms
-
application/jsonExtension: .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+jsonExtension: .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+jsonA detailed API error response under RFC 9457, with fields such as type, title, and status.
-
application/xmlExtension: .xml. An XML document. This is the recommended type under RFC 7303.
-
text/xmlExtension: .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+xmlExtension: .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+xmlExtension: .atom. A feed of updates in Atom format (RFC 4287).
-
application/manifest+jsonExtension: .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/wasmExtension: .wasm. WebAssembly code. Loading with WebAssembly.instantiateStreaming fails when the file isn't sent with this type.
-
application/yamlExtensions: .yaml, .yml. Configuration and data files in YAML syntax (RFC 9512).
-
application/sqlExtension: .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-urlencodedNo 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-dataNo 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/byterangesNo extension. A response with several ranges of the same file, together with the status 206 Partial Content.
Audio and video
-
video/mp4Extension: .mp4. The most common format for videos on websites, supported in all browsers.
-
video/webmExtension: .webm. Video in WebM format for websites. A name not registered with IANA, but common in practice and supported in most browsers.
-
video/oggExtension: .ogv. Video in Ogg format.
-
video/quicktimeExtension: .mov. Video in QuickTime format, common in iPhone recordings. Not all browsers display it, so convert it to MP4 before uploading.
-
video/matroskaExtension: .mkv. Video in Matroska format, registered in RFC 9559. Browser support is partial.
-
audio/mpegExtension: .mp3. Audio in MP3 format. The name audio/mp3 isn't registered, and the correct type is audio/mpeg.
-
audio/mp4Extension: .m4a. Audio in an MP4 file, usually in AAC format.
-
audio/aacExtension: .aac. Audio in AAC format.
-
audio/oggExtensions: .ogg, .oga, .opus. Audio in an Ogg file, in Vorbis or Opus format.
-
audio/flacExtension: .flac. Lossless audio (RFC 9639).
-
audio/wavExtension: .wav. Audio, usually uncompressed. A name not registered with IANA, but common in practice.
-
audio/webmExtension: .weba. Audio in a WebM file. A name not registered with IANA, but common in practice.
Downloads, documents, and archives
-
application/octet-streamAny extension. A binary file of unknown type. The browser doesn't display a file like this, and usually offers to save it.
-
application/pdfExtension: .pdf. A PDF document, which most browsers display directly. To download it instead of displaying it, add Content-Disposition: attachment.
-
application/zipExtension: .zip. A ZIP archive.
-
application/gzipExtension: .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-tarExtension: .tar. A TAR archive. A name not registered with IANA, but common in practice.
-
application/x-7z-compressedExtension: .7z. A 7-Zip archive. A name not registered with IANA, but common in practice.
-
application/vnd.rarExtension: .rar. A RAR archive.
-
application/zstdExtension: .zst. A file compressed with Zstandard (RFC 8878).
-
application/mswordExtension: .doc. A Word document in the old format.
-
application/vnd.openxmlformats-officedocument.wordprocessingml.documentExtension: .docx. A Word document in the current format.
-
application/vnd.openxmlformats-officedocument.spreadsheetml.sheetExtension: .xlsx. An Excel spreadsheet in the current format.
-
application/epub+zipExtension: .epub. An ebook in EPUB format.
Setting the type on the server
-
AddType application/manifest+json .webmanifestIn 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 .mjsIn an .htaccess file: sends scripts and modules with the recommended JavaScript type. Useful when the server doesn't recognize the .mjs extension.
-
AddDefaultCharset UTF-8In 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 .jsIn an .htaccess file: adds the character encoding to the type of other extensions, such as stylesheets and scripts.
-
ForceType application/octet-streamIn 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/javascriptThe 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/ecmascriptAn old name for JavaScript, marked obsolete in RFC 9239 together with application/ecmascript. Use text/javascript.
-
application/font-woffThe old name for WOFF fonts, deprecated in RFC 8081. Use font/woff and font/woff2.
-
application/x-gzipA 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-compressedA 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.
No matching types.
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.
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.
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.