← Back to Home

MIME Type Lookup

Find MIME types for file extensions

Images

.jpg → image/jpeg
.png → image/png
.gif → image/gif
.svg → image/svg+xml
.webp → image/webp

Documents

.pdf → application/pdf
.doc → application/msword
.docx → application/vnd.openxmlformats-officedocument.wordprocessingml.document
.txt → text/plain
.rtf → application/rtf

Web

.html → text/html
.css → text/css
.js → application/javascript
.json → application/json
.xml → application/xml

Media

.mp4 → video/mp4
.mp3 → audio/mpeg
.wav → audio/wav
.avi → video/x-msvideo
.mov → video/quicktime

What is a MIME Type?

Why is it Important?

  • العرض الصحيح: يضمن عرض المتصفحات للمحتوى بشكل صحيح (على سبيل المثال، عرض صورة مقابل تنزيلها).
  • الأمان: يساعد في منع المخاطر الأمنية عن طريق منع المتصفحات من إساءة تفسير أنواع الملفات (على سبيل المثال، تنفيذ برنامج نصي متخفي في صورة).
  • تكوين الخادم: ضروري لتكوين خوادم الويب (مثل Apache أو Nginx) لخدمة الملفات برأس `Content-Type` الصحيح.

Frequently Asked Questions:

What if I can't find a MIME type for my file extension?

Is a MIME type the same as a file extension?

📚 Understanding MIME Types

MIME (Multipurpose Internet Mail Extensions) types are a standardized way to indicate the nature and format of a document, file, or collection of bytes transmitted over the internet. Originally designed for email attachments, MIME types have become essential for web browsers, servers, and applications to properly handle different types of content. Every file served over HTTP includes a MIME type in its Content-Type header, telling the browser whether the content is an HTML page, a JPEG image, a PDF document, or any other format. Understanding MIME types is crucial for web developers, as incorrect MIME types can cause browsers to misinterpret files, leading to security vulnerabilities, broken downloads, or improperly displayed content. Our MIME Type Lookup tool provides instant access to the correct MIME type for any file extension, helping developers ensure their web applications serve files correctly and securely.

🎯 Practical Use Cases

  • Web Server Configuration: Configure Apache, Nginx, or IIS servers with correct MIME types to ensure browsers properly interpret files. This is essential when serving new file types or custom extensions.
  • File Upload Systems: Validate uploaded files by checking their MIME types against expected values, preventing users from uploading malicious files disguised with incorrect extensions.
  • API Development: Set proper Content-Type headers in REST API responses to ensure clients correctly parse JSON, XML, CSV, or other data formats.
  • Email Attachments: Specify correct MIME types when sending email attachments programmatically to ensure email clients display or offer downloads appropriately.
  • Content Delivery Networks: Configure CDNs with proper MIME types for static assets to ensure optimal caching and browser behavior.
  • Mobile App Development: Handle file downloads and previews in mobile apps by using MIME types to determine how to display or process different file formats.
  • Security Implementations: Prevent MIME-sniffing attacks by explicitly setting X-Content-Type-Options headers and ensuring MIME types match file contents.

💡 Best Practices and Tips

Server Configuration

  • Always Set Content-Type: Explicitly set Content-Type headers for all served files. Never rely on browsers to guess the MIME type based on file extensions.
  • Use X-Content-Type-Options: Add the `X-Content-Type-Options: nosniff` header to prevent browsers from MIME-sniffing, which can lead to security vulnerabilities.
  • Validate File Contents: Don't trust file extensions alone. Validate actual file contents match the declared MIME type, especially for user uploads.
  • Keep MIME Types Updated: Regularly update your server's MIME type mappings to support new file formats like WebP, AVIF, or WOFF2.

Common MIME Type Categories

  • Text: text/plain, text/html, text/css, text/javascript
  • Images: image/jpeg, image/png, image/gif, image/svg+xml, image/webp
  • Application: application/json, application/pdf, application/zip, application/octet-stream
  • Video: video/mp4, video/webm, video/ogg
  • Audio: audio/mpeg, audio/wav, audio/ogg

Troubleshooting Tips

  • If CSS files aren't loading, check for text/plain instead of text/css
  • If JavaScript isn't executing, verify it's served as application/javascript or text/javascript
  • If downloads start instead of displaying in browser, check if MIME type is application/octet-stream
  • Use browser developer tools to inspect actual Content-Type headers being sent by your server