MIME Type Detector

Detect MIME types from file content or extensions.

MIME Type Detection

MIME types identify file formats - "text/html" for web pages, "application/json" for JSON, "image/png" for PNG images. Servers use these to tell browsers how to handle files.

This tool detects MIME types from file extensions or file contents. Useful when configuring web servers, debugging content-type issues, or identifying unknown files.

Common MIME Types

  • text/html: HTML documents
  • application/json: JSON data
  • image/jpeg: JPEG images
  • application/pdf: PDF documents

Understanding MIME Types

MIME (Multipurpose Internet Mail Extensions) types identify file formats on the internet. Originally designed for email attachments, they're now used throughout the web to tell browsers how to handle different content. A MIME type consists of a type and subtype separated by a slash, like "text/html" or "image/png".

The Content-Type header uses MIME types to tell browsers how to display content. Getting this wrong can cause security vulnerabilities or broken functionality'for example, serving JavaScript with "text/plain" prevents execution.

Frequently Asked Questions

Why might browser MIME and actual MIME differ?

Browsers often guess MIME types from file extensions, which can be wrong. Actual MIME detection reads the file's "magic bytes" (the first few bytes that identify the format). A .jpg file renamed to .png would show different browser vs. actual types.

Why is MIME type validation important for security?

Attackers can rename malicious files (like PHP scripts) with innocent extensions (like .jpg) to bypass upload filters. Actual MIME detection reveals the true file type regardless of extension, preventing this attack vector.

What is application/octet-stream?

This is the default MIME type for unknown binary files. It tells browsers to download rather than display the content. It's used when the specific file type can't be determined from the extension or file signature.