MIME Type Finder: File Extensions to Content-Type Reference
Setting the wrong Content-Type header is a common source of bugs — a file that downloads instead of previewing, an upload validator that rejects a valid file, or an API response a browser refuses to parse. This searchable reference maps common file extensions to their correct MIME type, organized by category.
Example: .png -> image/png -> Content-Type: image/png
MIME Types and the Content-Type Header
When a server responds to a request, the Content-Type HTTP header tells the browser what kind of data follows, using the MIME type as its value. Getting this wrong is why you sometimes see a PDF try to download as plain text, or an image render as a wall of binary garbage in the browser.
Choosing Between Similar Types
Some file kinds have more than one type in circulation — .js files have historically used both application/javascript and text/javascript, for instance. This reference lists the modern, widely-recommended type for each extension so you're not guessing between legacy options.
Validating Uploads by MIME Type
Server-side upload validation often checks the MIME type reported by the browser (or better, sniffs the file's actual magic bytes) against an allowlist. Knowing the exact expected type — image/jpeg vs. image/jpg (which isn't standard) — avoids rejecting valid files due to a typo in your allowlist.
Practical Examples
Setting a Download Header Correctly
Serving a generated PDF report.
- 1.File: report.pdf
- 2.MIME Type: application/pdf
- 3.Header: Content-Type: application/pdf
Validating an Image Upload
Restricting uploads to common image formats.
- 1.Allowlist: image/png, image/jpeg, image/webp
- 2.Uploaded file: photo.webp
- 3.Check: image/webp is in the allowlist -> accept
Categories Covered
- Text & Code: txt, html, css, js, json, py, sql
- Images: jpg, png, gif, webp, svg, avif, heic
- Audio & Video: mp3, wav, mp4, webm, mov
- Documents: pdf, docx, xlsx, pptx
- Archives & Fonts: zip, tar, woff2, ttf
Where MIME Types Matter Most
- Setting Content-Type on API and file-serving responses
- Validating file uploads server-side
- Configuring CORS and Content-Security-Policy rules by resource type
- Building download links with the correct 'type' attribute
Frequently Asked Questions
What is a MIME type?
A MIME type (also called a media type or Content-Type) tells a browser or application what kind of data a file contains — for example, image/png for a PNG image or application/json for JSON data — so it knows how to handle or render it.
Why does the MIME type matter for file uploads?
Servers and browsers use the Content-Type header to decide how to process a file — whether to render it inline, force a download, or validate that an upload matches an expected file type. Setting the wrong MIME type can cause browsers to render or block content incorrectly.
What's the difference between application/octet-stream and a specific type?
application/octet-stream is a generic 'unknown binary data' fallback. Using the specific type (like application/pdf) when you know it lets browsers and tools handle the file correctly instead of just offering a generic download.
Why do some extensions map to more than one possible MIME type?
A few extensions have both an older and a newer standardized type (for example, some servers still send text/javascript vs the historical application/javascript for .js files) — this table shows the modern, widely-recommended type.
Can I search by MIME type instead of extension?
Yes. Typing part of a MIME type (like 'json' or 'image/') filters the table the same way searching by extension does.
Is this list exhaustive?
It covers the most common file types developers encounter day to day — text, code, images, audio, video, documents, archives, fonts, and binaries — not the full IANA media types registry, which has thousands of entries.