MIME Type Lookup MIME type lookup table
Quickly query the MIME Type corresponding to various file extensions, support Extension → MIME with MIME → Extension Two-way query.
Built-in HTTP Header Preview, an essential tool for web development and API design.
📋 HTTP Header Preview
After clicking on any MIME Type above, the corresponding HTTP Header example will be displayed here.
Click the MIME Type card to view the HTTP Header
❓ FAQ FAQ
Frequently Asked Questions and Answers about MIME Type
What is a MIME type? Why is it important?
MIME Type(Multipurpose Internet Mail Extensions Type) is a standardized label used to identify the format and content type of files. Originally designed for use with email attachments, it was later widely adopted by the HTTP protocol and became the basis for Web communications.
The format of MIME Type is type/subtype, for example text/html、application/json、image/png。
Why is it important?
- Browser display judgment — The browser determines how to render content (HTML, images, downloads) based on Content-Type
- API development — REST API uses Content-Type and Accept headers for content negotiation
- File upload verification — The server verifies the uploaded file type through MIME Type
- Server settings — Web servers (Nginx, Apache) need to configure MIME Type mapping correctly
- security — Incorrect MIME Type may lead to MIME type confusion attacks
What is the difference between Content-Type and Accept headers?
Both are MIME Type-related headers in HTTP, but serve different purposes:
Content-Type(request/response headers)
tell the recipient "What type of data is this?". In the response, the server uses it to tell the browser how to parse the response content. In the request, the client uses it to tell the server the format of the request body.
Accept(request header)
Tell the server "What types of data can the client accept?". The server determines which format of response to send back based on the value of the Accept header.
Simple memory method: Content-Type is "what do I give you" and Accept is "what do I want".
How to correctly set the MIME Type of the server?
Different web servers have different ways of setting MIME Type:
Nginx
include mime.types;types { application/javascript js; }
Apache
AddType application/javascript .jsAddType text/html .html
Node.js / Express
res.type('json')res.set('Content-Type', 'application/json')
⚠️ NOTE: Incorrect MIME Type settings may cause the browser to fail to parse files correctly, and may even cause security issues. For example, convert a user-uploaded file to text/html Providing may lead to XSS attacks.
What is application/octet-stream? When to use?
application/octet-stream It is a universal MIME Type for binary data, equivalent to "unknown binary file". This MIME Type is used when the server cannot determine the specific type of file.
Common usage scenarios:
- Force download — When setting
Content-Type: application/octet-stream, the browser will force download the file instead of trying to display it - File download function — Many download functions use this MIME Type
Content-Disposition: attachmentheader - Unknown file type — Safe defaults when the server does not recognize file extensions
💡 Recommendation: Whenever possible, use a specific MIME Type rather than application/octet-stream so that browsers and clients can handle the file correctly.
What is the relationship between MIME Type and file extension?
The MIME Type and file extension arecorrespond to each other relationship, but not 100% one-to-one:
- one to many — A MIME Type may correspond to multiple file extensions (such as
audio/mpegCorrespond.mp3、.mpga) - many to one — A file extension may also correspond to multiple MIME Types (such as
.xmlcan betext/xmlorapplication/xml) - Web server mapping — Servers such as Nginx and Apache use the MIME Type mapping table to determine how to handle requests for each file extension.
That's why this tool supports Extension → MIME with MIME → Extension The reason for two-way query - allows you to find the corresponding information from either direction.
💡 Useful reminder: The server looks up the MIME Type based on the file extension to set the Content-Type header. If the mapping table is incomplete, an incorrect MIME Type may be returned or application/octet-stream may be used directly.
What is a "MIME type confusion attack"? How to prevent it?
MIME Type Confusion Attack It is a security vulnerability that allows attackers to bypass security checks by disguising malicious files as other types.
Common attack methods:
- Upload with JavaScript
.htmlarchive but marked asimage/png - Exploiting incorrect server MIME Type settings to cause browsers to execute text files as HTML
Precautions:
- Use
X-Content-Type-Options: nosniffHeader prevents browser MIME sniffing - Verify the actual MIME Type when uploading files (check the file magic byte) instead of relying solely on Content-Type
- Used when downloading files
Content-Disposition: attachment - Restrict the whitelist of file extensions that can be uploaded
What is the MIME Type of modern image formats such as WebP and AVIF?
Modern web page image formats and their corresponding MIME Types:
- WebP —
image/webp(Developed by Google, supports lossy/lossless compression and transparency) - AVIF —
image/avif(Based on AV1 encoding, compression rate is better than WebP) - SVG —
image/svg+xml(vector graphics, scalable) - ICO —
image/x-icon(Web icon format) - HEIF / HEIC —
image/heif/image/heic(Commonly used in the Apple ecosystem)
⚠️ NOTE: Newer formats (such as AVIF, WebP) may require older server software to manually add MIME Type mapping, otherwise it may be returned application/octet-stream As a result, the browser cannot display correctly.
📖 Complete Guide to MIME Types
Learn more about how MIME Types work and best practices
What is a MIME type?
MIME Type(Multipurpose Internet Mail Extensions Type) is a standardized label used to identify file formats in Internet communications. Its history dates back to 1992 and was originally designed to solve the problem of email attachments being unable to transmit binary data. With the popularity of the HTTP protocol, MIME Type has been fully adopted by the Web and has become the basic language for communicating content formats between browsers, servers, and APIs.
A MIME Type consists of two parts:main type with subtype, separated by a slash. For example text/html Represents "HTML format of text type".
In HTTP communication, MIME Type is mainly passed through two headers:Content-Type(Inform the recipient of the format of the current content) and Accept(Tells the server the formats the client can accept). This mechanism is called Content Negotiation。
MIME Type classification overview
MIME Type is divided into ten categories, each category represents a type of digital content:
Text (text class)
Text MIME Type is used to mark plain text or markup language files. The most common is text/html(HTML web page),text/css(style sheet),text/plain(plain text) and text/csv(comma separated values). Text-based encoded information is usually encoded through charset Parameters are additionally specified, such as text/html; charset=utf-8。
Image (picture class)
Image MIME Type covers all static and dynamic image formats. Common ones include image/png(portable network graphics),image/jpeg(JPEG photo),image/gif(GIF animation/static image),image/svg+xml(vector graphics) and image/webp(Modern image format developed by Google).
In modern web development, choosing the correct image format and MIME Type Page loading speed and SEO score There is a direct impact. WebP and AVIF formats have become the first choice for performance optimization due to their excellent compression ratio.
Audio (audio) and Video (video)
Multimedia MIME Type is used for streaming and downloading audio/video files.audio/mpeg(MP3) is the most popular audio format, and video/mp4(MP4) is the standard format for modern videos. Other common ones include audio/ogg、audio/wav、video/webm Wait.
In HTML5,<audio> with <video> The element relies on the correct Content-Type to determine whether the media file can be played.
Application (application class)
This is the most diverse category, covering a variety of structured data, code, and binary formats.application/json Is the core format of modern REST APIs,application/javascript(or text/javascript) for JavaScript files,application/pdf It is the most widely used file format.
application/octet-stream It is a special universal binary MIME Type used when the server cannot determine the file type, which usually triggers the browser's download behavior instead of display.
Font (font type)
The MIME Type of Web Fonts is crucial for websites that use custom fonts. Common ones include font/ttf(TrueType)、font/otf(OpenType)、font/woff and font/woff2(Web Open Font Format). WOFF2 is currently the preferred format for web fonts due to its best compression rate.
Archive (compressed archive type) and Document (file type)
Compressed file types covered application/zip、application/gzip、application/x-tar Wait. File categories include application/pdf、application/msword(.doc)、application/vnd.openxmlformats-officedocument.wordprocessingml.document(.docx) etc.
Practical application of Content-Type and HTTP Header
In HTTP communications, the Content-Type header determines how the browser handles content returned by the server. If the server returns Content-Type: text/html, the browser will parse the content into HTML. If return Content-Type: application/json, the browser knows that this is JSON data and usually needs to be processed by JavaScript.
Practical example:
When you request a .jpg image, the server's response contains:
Content-Type: image/jpeg
When the browser receives this header, it knows to render the content as a JPEG image rather than download it. This is how MIME Type works in everyday browsing.
File upload and MIME Type verification
MIME Type verification is an important part of security when handling file uploads. But developers need to pay attention to:Content-Type sent by the client can be forged. Therefore it is unsafe to rely solely on the Content-Type in the HTTP request to verify the file type.
Best practice is to check files on the server sideMagic Bytes — Each file format has a unique sequence of bytes at the beginning. For example, a JPEG file begins with FF D8 FF, PNG is 89 50 4E 47. This method of verification is far more secure than relying on the Content-Type header.
MIME Type Security and Best Practices
In order to prevent MIME type confusion attacks, the industry has developed a variety of protection mechanisms:
- X-Content-Type-Options: nosniff — Tell the browser not to do MIME sniffing and strictly adhere to the Content-Type returned by the server
- Content-Disposition: attachment — Force the browser to download the file instead of trying to display it
- Correct MIME mapping table — Make sure the server returns the correct Content-Type for each file extension
- Content Security Policy (CSP) — Limit the types of resources that can be loaded via CSP headers
Summary: MIME Type is the basic knowledge of web development. From HTTP header setting, file upload verification to front-end resource loading, everything is closely related to MIME Type. Correctly understanding and using MIME Type will not only allow your website to operate more normally, but also improve security and user experience. Use ToolHub's MIME Type Lookup tool to quickly look up the correspondence between any file extension or MIME Type.