What is a file extension? Why does it matter?

It’s part of the filename that tells your computer what the file (probably) contains.

Assigning meaning to numbers

When you save a document, it is stored as a long list of numbers.  You may have heard that “computers can only count ones and zeroes”, and at the lowest level, this is correct.  We can represent those numbers any way we like; here are document contents represented as base 16 (hexadecimal).

D0 CF 11 E0 A1 B1 1A E1 00 00 00 00 00 00 00 00

This still isn’t useful.  We want to open the document in an application that displays those numbers in a way that is meaningful to us.  Does anything here tell us which application to use?

Something does, in fact: the name of the file is “Words.xls”.  “Words” is the name I gave it, but the “xls” tells us that it’s a Microsoft Excel Spreadsheet.

Why do I need to know this?

When you double-click on a file on your computer, the computer will usually open the correct application.  In an ideal world, it would always be right, and you could trust it.  However, sometimes computers make mistakes.  Your computer guesses at the correct application to open based on the file extension.  Sometimes these guesses are wrong.

If someone e-mails you a file you can’t read, knowing the extension can help.  A common example in recent years has been Microsoft Office files from 2007 onwards.  If you receive a .docx, .xlsx or .pptx file and can’t read it, you may still be using Microsoft Office 2004 or earlier.

Knowing the correct application will not always help; you can’t rush out and buy a new application every time someone sends a new file.  In the particular case of Microsoft Office documents, you can also download converters for your existing Windows or Mac OS version of Office.  It is not always so simple.

How can I see the extensions?

Both Windows and Mac OS hide extensions for recognised file types by default.  You can change this.

Once you display extensions, it becomes possible to change them.  While it is often helpful to the extensions, do not change one unless you are sure the existing extension is wrong.

If you want to convert a document to a different type — say, convert a Word 2007 .docx file to a Word 98 .doc file so someone else a can read it — you must open the file and export it in the appropriate format. Changing the extension from “docx” to “doc” will not fix the file contents, and will just confuse the recipient.

Yes, there are people who do this. Please don’t become one of them.

On Windows, open an Explorer window, go to the “Tools” menu, select “Folder Options” and uncheck “Hide extensions for known file types”.

Windows Explorer Folder Options dialog box, showing the "Hide extensions for known file types" box unchecked.

On Mac OS, open a Finder window, go to the “Finder” menu, select “Preferences”, the “Advanced” tab, and check “Show all filename extensions”.

Mac OS Finder Preferences dialog showing "Show all filename extensions" checked.

Which extensions indicate that a file is safe to open?

None of them. The damage a malicious file can do to your computer depends on the application that attempts to open it, not the file type. Keep your applications up to date, and only open file attachments you were expecting to receive, sent by people you know.

Ancient History Supplement

My Mac correctly opens files with the same extension in different applications. How does it do that?

A Mac user sent me a file with no extension at all. How do they get any work done?

Mac OS used to store a code indicating the application that saved each file. This was called a Creator Code. So, a JPEG file saved from Photoshop would open in Photoshop, and a JPEG file saved from Netscape Communicator would open in Netscape Communicator. File extensions were ignored unless the creator code was missing.

This worked well for files saved on a given computer and opened on the same computer. However, when files were sent over the Internet, they lost their creator codes, resulting in inconsistent behaviour. From Mac OS 10.6 “Snow Leopard”, onwards, creator codes are ignored.

Wikipedia entry on Creator codes

Why are so many extensions three letters long?

Before Windows existed, you controlled your IBM compatible computer using DOS (Disk Operating System). DOS limited filenames to 8 characters, and file extensions to 3 characters.

This was a logical choice given the limited storage available on computers at the time. On the other hand, earlier operating systems did manage to store longer filenames. Neither limit applies any longer, allowing everyone to choose more meaningful names, and application programmers to choose more meaningful extensions.

Wikipedia entry on DOS

Leave a Reply

Your email address will not be published. Required fields are marked *

Your e-mail address will not be published or shared with third parties.

First comments from new name/e-mail combinations will be held in moderation.