What is the MIME type of .pdf files?
The MIME type (media type) for PDF document files with the .pdf extension is application/pdf. Browsers show PDFs inline by default. Use Content-Disposition: attachment to force a download instead.
Content-Type header
Content-Type: application/pdf
Server configuration
| Server | Configuration |
|---|---|
Nginx (mime.types or types {}) | application/pdf pdf; |
Apache (.htaccess) | AddType application/pdf .pdf |
IIS (web.config) | <mimeMap fileExtension=".pdf" mimeType="application/pdf" /> |
| Node.js / Express | res.type('pdf') or res.setHeader('Content-Type', 'application/pdf') |
| Amazon S3 | Set Content-Type: application/pdf on the object (metadata), or pass --content-type application/pdf to aws s3 cp |
Should .pdf files be compressed?
No. PDF document files are already compressed internally, so gzip or Brotli would waste CPU and barely reduce — sometimes even increase — the size. Leave application/pdf out of your compression configuration.
Why the MIME type matters
Browsers decide what to do with a response — render, run, play or download — from the Content-Type header, not the file extension. With X-Content-Type-Options: nosniff, a wrong type causes stylesheets and scripts to be blocked outright. For uploads, never trust the type sent by the client; check the file’s content (its magic bytes) on the server.
Frequently asked questions
What is the MIME type for .pdf?
application/pdf.How do I set the Content-Type for .pdf in Nginx?
application/pdf pdf; is listed in the types block (usually in /etc/nginx/mime.types) and reload Nginx.