Can I change a file's extension?

Generally, changing the file extension of a file is not a good idea. Changing file extensions is usually unnecessary because files typically already have the appropriate extension. When you double-click a file that has the right extension, it will open with the correct program. For example, a file with a .TXT extension will open in a text editor, and a file with a .JPG extension will open in an image viewer.

JPEG File If you change a file's extension, it may cause the file not to open. Take, for example, the JPEG image to the left. (While the file used in this example is from a Macintosh computer, the same principles apply to both Mac and Windows platforms.)

The filename of this file is rose.jpg and is formatted as a JPEG image. Let's see what happens if we try to change the file extension to ".gif," which is the extension GIF images use. By clicking the filename twice (slower than a double-click), we can change the filename. We replace ".jpg" with ".gif" and hit Enter.

When this change is made in macOS, an alert pops up asking us to verify that we want to make the change.

Change Extension Alert

This alert is for good reason, as it warns the user that the file may open in a different application if its extension is changed. To be on the safe side, macOS selects "Keep .jpg" as the default option.

If we decide to make the change and click the "Use .gif" option, the filename is changed as seen below:

Changing a File Extension

The rose.jpg file opened fine in Photoshop before we changed the file extension. Now that we changed the extension let's see what happens when we drag it to Photoshop.

Photoshop tries to open the file, but is unable to. Instead, we get an error message.

Could Not Open the File

Because Photoshop was expecting a GIF file type, based on the file extension, it tried to parse a GIF file. However, the file is actually formatted as a JPEG file, so Photoshop registers an error when attempting to open it.

When you change a file's extension, you change the way programs on your computer read the file. The problem is, changing the file extension does not change the file type. In other words, when you change a file's extension, it does not change the way the file is formatted.

By modifying a file extension of a certain file, you may cause programs on your computer to read the file incorrectly, which may prevent it from opening. This is why it is typically not a good idea to change file extensions.

When you should change a file extension

While file extensions should typically be left alone, there may be times when changing a file's extension is the only way to get it to open. For example, you may receive an e-mail attachment called report.pdf that is actually formatted as a Word document.

When you double-click the file, Acrobat Reader will most likely try to open the file, since Acrobat Reader is what most computers use to view PDFs. Because Acrobat Reader is expecting a .PDF file, when it encounters a Word document, it may not be able to open the file. If you change the filename to report.doc, the file should open in Microsoft Word.

Changing a file's extension can "force" the file to open in a different program. This can be useful when a file will not open using the default program. However, a better way to change what program opens a certain file is to modify the file's properties.

See Changing What Program Opens a File in Windows and Changing What Program Opens a File on a Mac for more information.