{"id":54,"date":"2026-08-17T11:36:00","date_gmt":"2026-08-17T11:36:00","guid":{"rendered":"https:\/\/easyextract.online\/blog\/file-extension-vs-mime-type\/"},"modified":"2026-09-21T15:20:01","modified_gmt":"2026-09-21T15:20:01","slug":"file-extension-vs-mime-type","status":"publish","type":"post","link":"https:\/\/easyextract.online\/blog\/file-extension-vs-mime-type\/","title":{"rendered":"File Extension vs MIME Type: Key Differences &#038; Comparison Table"},"content":{"rendered":"<p><strong>A file extension is the suffix in a filename (<code>.pdf<\/code>, <code>.jpg<\/code>) \u2014 a human-facing label that can be changed or wrong. A MIME type is the media type a program declares and acts on (<code>application\/pdf<\/code>, <code>image\/jpeg<\/code>). The authoritative answer to &#8220;what is this file really?&#8221; is neither \u2014 it&#8217;s the file&#8217;s magic bytes, the signature at the start of its contents.<\/strong> These three describe a file&#8217;s type in different ways, and knowing which to trust prevents a lot of confusion.<\/p>\n<p>This guide explains each, why they can disagree, and why tools that read files rely on the contents rather than the name. See also the <a href=\"https:\/\/easyextract.online\/supported-file-formats\/\">supported file formats<\/a> list.<\/p>\n<h2>File extension: a label in the name<\/h2>\n<p>The extension is just the text after the last dot in the filename. It tells your operating system which program to open the file with, which is why double-clicking <code>report.pdf<\/code> launches a PDF reader. But the extension is <strong>only a label<\/strong> \u2014 nothing forces it to match the contents. Rename <code>photo.jpg<\/code> to <code>photo.txt<\/code> and the pixels don&#8217;t change; only the hint does. This is why extensions can lie, by accident (a mislabelled download) or on purpose (disguising a file).<\/p>\n<h2>MIME type: the media type a program acts on<\/h2>\n<p>A <strong>MIME type<\/strong> (also called a media type or content type) is a standard two-part label like <code>type\/subtype<\/code> \u2014 <code>application\/pdf<\/code>, <code>image\/png<\/code>, <code>text\/csv<\/code>. It&#8217;s the language the web and applications use to say what a file <em>is<\/em>, independent of its name. When you download a file, the server sends a <code>Content-Type<\/code> header carrying its MIME type, and your browser uses that to decide how to handle it. MIME types are more precise than extensions, but they can still be set incorrectly by whatever produced the file.<\/p>\n<h2>Magic bytes: the real proof<\/h2>\n<p>The trustworthy signal is inside the file. Most formats begin with a fixed <strong>signature<\/strong> \u2014 &#8220;magic bytes&#8221; \u2014 that identifies them regardless of name or declared type:<\/p>\n<ul>\n<li><code>%PDF<\/code> \u2014 a PDF<\/li>\n<li><code>PK<\/code> (0x50 0x4B) \u2014 a ZIP, and therefore also <code>.docx<\/code>, <code>.xlsx<\/code>, <code>.pptx<\/code> and <code>.epub<\/code>, which are ZIP-based<\/li>\n<li><code>&#xFF;&#xD8;&#xFF;<\/code> \u2014 a JPEG<\/li>\n<li><code>&#x89;PNG<\/code> \u2014 a PNG<\/li>\n<li><code>MZ<\/code> \u2014 a Windows executable (<code>.exe<\/code>, <code>.dll<\/code>)<\/li>\n<\/ul>\n<p>Reading the first few bytes tells you what a file genuinely is. This is how a robust tool decides how to process a file \u2014 not by trusting the extension.<\/p>\n<h2>Why the difference matters<\/h2>\n<ul>\n<li><strong>Mislabelled files.<\/strong> A file saved with the wrong extension still opens correctly in a tool that checks its contents, even though a double-click might fail.<\/li>\n<li><strong>Security.<\/strong> Because extensions can be faked, relying on the name alone to decide a file is &#8220;safe&#8221; is a classic mistake; content inspection is the defence.<\/li>\n<li><strong>Extraction.<\/strong> An extractor that reads magic bytes can tell a real <code>.xlsx<\/code> (a ZIP) from an old binary <code>.xls<\/code> even if both are named the same, and route each correctly.<\/li>\n<\/ul>\n<h2>Frequently asked questions<\/h2>\n<p><strong>What is the difference between a file extension and a MIME type?<\/strong><br \/>\nThe extension is the suffix in the filename (a label for the OS); the MIME type is the media type a program declares and acts on (like <code>application\/pdf<\/code>). The extension names the file; the MIME type describes its content.<\/p>\n<p><strong>Can a file&#8217;s extension be wrong?<\/strong><br \/>\nYes. The extension is only a label and can be changed or mislabelled without altering the contents. The file&#8217;s magic bytes reveal its true type.<\/p>\n<p><strong>What are magic bytes?<\/strong><br \/>\nA fixed signature at the start of a file that identifies its format regardless of the filename \u2014 for example <code>%PDF<\/code> for a PDF or <code>PK<\/code> for a ZIP-based file.<\/p>\n<p><strong>Why do DOCX and XLSX start with &#8220;PK&#8221;?<\/strong><br \/>\nBecause they are ZIP archives of XML, and <code>PK<\/code> is the ZIP signature. Their real type is confirmed by the parts inside the archive.<\/p>\n<p><strong>Which should I trust to identify a file?<\/strong><br \/>\nThe magic bytes. Extensions and even declared MIME types can be wrong; the file&#8217;s own signature is authoritative.<\/p>\n<h2>Related reading<\/h2>\n<ul>\n<li><a href=\"https:\/\/easyextract.online\/blog\/what-is-inside-an-xlsx-file\/\">What&#8217;s inside an XLSX file?<\/a><\/li>\n<li><a href=\"https:\/\/easyextract.online\/blog\/what-is-data-extraction\/\">What is data extraction?<\/a><\/li>\n<\/ul>\n<p><em>Last updated: 16 August 2026.<\/em><\/p>\n<p><script type=\"application\/ld+json\">\n{\"@context\":\"https:\/\/schema.org\",\"@type\":\"FAQPage\",\"mainEntity\":[\n{\"@type\":\"Question\",\"name\":\"What is the difference between a file extension and a MIME type?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"The extension is the suffix in the filename (a label for the OS); the MIME type is the media type a program declares and acts on (like application\/pdf). The extension names the file; the MIME type describes its content.\"}},\n{\"@type\":\"Question\",\"name\":\"Can a file's extension be wrong?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"Yes. The extension is only a label and can be changed or mislabelled without altering the contents. The file's magic bytes reveal its true type.\"}},\n{\"@type\":\"Question\",\"name\":\"What are magic bytes?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"A fixed signature at the start of a file that identifies its format regardless of the filename - for example %PDF for a PDF or PK for a ZIP-based file.\"}},\n{\"@type\":\"Question\",\"name\":\"Why do DOCX and XLSX start with PK?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"Because they are ZIP archives of XML, and PK is the ZIP signature. Their real type is confirmed by the parts inside the archive.\"}},\n{\"@type\":\"Question\",\"name\":\"Which should I trust to identify a file?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"The magic bytes. Extensions and even declared MIME types can be wrong; the file's own signature is authoritative.\"}}\n]}<\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A file extension is the suffix in a filename (.pdf, .jpg) \u2014 a human-facing label that can be changed or wrong. A MIME type is the media type a program declares and acts on\u2026<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"slim_seo":[],"footnotes":""},"categories":[3],"tags":[],"class_list":["post-54","post","type-post","status-publish","format-standard","hentry","category-guides"],"_links":{"self":[{"href":"https:\/\/easyextract.online\/blog\/wp-json\/wp\/v2\/posts\/54","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/easyextract.online\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/easyextract.online\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/easyextract.online\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/easyextract.online\/blog\/wp-json\/wp\/v2\/comments?post=54"}],"version-history":[{"count":3,"href":"https:\/\/easyextract.online\/blog\/wp-json\/wp\/v2\/posts\/54\/revisions"}],"predecessor-version":[{"id":129,"href":"https:\/\/easyextract.online\/blog\/wp-json\/wp\/v2\/posts\/54\/revisions\/129"}],"wp:attachment":[{"href":"https:\/\/easyextract.online\/blog\/wp-json\/wp\/v2\/media?parent=54"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/easyextract.online\/blog\/wp-json\/wp\/v2\/categories?post=54"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/easyextract.online\/blog\/wp-json\/wp\/v2\/tags?post=54"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}