FileDummy Logo
FileDummy
File Formats & Deep Dives

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.

October 26, 202610 min read1,420 views
mime-typescontent-typehttpwebreference

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

ExtensionMIME TypeDescription
.pdfapplication/pdfAdobe PDF Document
.docxapplication/vnd.openxmlformats-officedocument.wordprocessingml.documentMicrosoft Word
.jsonapplication/jsonJavaScript Object Notation
.csvtext/csvComma-Separated Values
.zipapplication/zipZIP Archive
.pngimage/pngPortable Network Graphics
.jpgimage/jpegJPEG Image
.txttext/plainRaw Plaintext
Verified Test Asset.csv

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
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.

NDL

Nguyen Dai Long

Author

Backend 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.

0/3000

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.

Related Articles