MIME Types Complete Reference: The Web Developer's Guide
Complete guide to MIME types (Content-Type) for web developers. Common MIME types, how browsers use them, server configuration, and security implications.
MIME types (Multipurpose Internet Mail Extensions), standardized by IANA, instruct web browsers and HTTP clients on how to interpret and render received byte streams. Setting incorrect MIME types results in files downloading as plain text, broken video streams, or security vulnerabilities like MIME-sniffing attacks.
Common Web MIME Types Reference
| Extension | MIME Type | Description |
|---|---|---|
.pdf | application/pdf | Adobe PDF Document |
.docx | application/vnd.openxmlformats-officedocument.wordprocessingml.document | Microsoft Word |
.json | application/json | JavaScript Object Notation |
.csv | text/csv | Comma-Separated Values |
.zip | application/zip | ZIP Archive |
.png | image/png | Portable Network Graphics |
.jpg | image/jpeg | JPEG Image |
.txt | text/plain | Raw Plaintext |
Download our 1MB CSV file served with standard text/csv headers to test your browser parser.
Download 1MB CSV Sample →Enforcing Content-Type in HTTP Headers
HTTP/1.1 200 OK
Content-Type: application/pdf
Content-Disposition: inline; filename="statement.pdf"
X-Content-Type-Options: nosniff
The Critical X-Content-Type-Options: nosniff Header
Older browsers attempted to "sniff" the content of a file regardless of what the Content-Type header declared. An attacker could upload an HTML file containing JavaScript disguised with a text/plain header; the browser would sniff the HTML tags and execute the malicious script (Cross-Site Scripting).
Setting X-Content-Type-Options: nosniff strictly commands the browser to trust the declared MIME type and refuse to execute non-executable files.
Nguyen Dai Long
AuthorBackend Lead • Distributed Systems & Cloud Edge Architecture Specialist
4+ years designing high-throughput file ingestion pipelines, database architectures, and distributed edge storage on Cloudflare R2 & AWS S3. Founder of FileDummy and the NDL Ecosystem.
Was this article helpful?
Click Like to support the author and help other developers discover this guide.
Engineering Discussion & Feedback (0)
Share benchmark results, report edge cases, or ask technical questions.
No comments yet. Be the first developer to start the discussion!
Frequently Asked Questions
What is the MIME type for PDF files?â–¾
application/pdf. Without the correct MIME type, some browsers display raw binary instead of rendering the PDF. Always serve PDF files with Content-Type: application/pdf.
What MIME type should I use for JSON API responses?â–¾
application/json. Not text/json (non-standard) or application/javascript (incorrect). For JSON:API specification responses, use application/vnd.api+json. UTF-8 is the JSON default per RFC 8259.
Why does the browser download a file instead of displaying it?â–¾
Two causes: (1) The server sends Content-Disposition: attachment — forces download regardless of MIME type. (2) The MIME type is application/octet-stream — browsers download unrecognized types. To display PDF inline, serve with Content-Type: application/pdf and Content-Disposition: inline.