What a file extension is and why you might change it

A file extension is the two to four letters after the dot at the end of a filename — like .pdf, .jpg, .docx, or .txt. It tells your computer what program should open the file and how to read the data inside. You might need to change an extension when you save a file in the wrong format, when you want to open it with a different program, or when you're organizing files and need them all in the same format.

Changing the extension itself is straightforward — you rename the file and swap out those letters. But it's worth understanding what actually happens when you do this. The extension is just a label; changing it doesn't convert the file's contents. If you rename a photo from .jpg to .txt, your computer will try to read image data as text, and you'll see gibberish. The file works only if the extension matches what's actually inside.

The safest approach is to convert the file using the program that created it — save it in the new format rather than just renaming it. But if you're organizing existing files or working with a format that doesn't need conversion, renaming the extension is quick and harmless.

Key Takeaways

  • A file extension is the letters after the dot in a filename, and it tells your computer which program should open the file.
  • Changing the extension only renames the label; it does not convert the file's contents, so the new extension must match what's actually inside the file.
  • On Windows, you may need to turn on "Show file extensions" in File Explorer settings before you can edit them.
  • On Mac, right-click the file, select "Rename", and edit the extension at the end of the filename.
  • The safest way to change a file's format is to use the original program and save it in the new format rather than just renaming the extension.

How to change a file extension on Windows

By default, Windows hides file extensions in File Explorer. You need to turn this on first. Open File Explorer, click the "View" tab at the top, and check the box next to "File name extensions". Now you'll see the full filename including the extension on every file.

Right-click the file you want to rename and select "Rename" from the menu. The filename will highlight and become editable. Use your arrow keys to move to the end of the name, then delete the current extension (the dot and the letters after it) and type the new one. Press Enter to save the change.

Windows will ask you to confirm that you want to change the extension. Click "Yes". The file now has the new extension, though remember that the contents inside haven't changed — only the label has.

How to change a file extension on Mac

On Mac, extensions are usually visible by default. If you don't see them, open Finder, click "Finder" in the menu bar, select "Settings", go to the "Advanced" tab, and check "Show all filename extensions".

Right-click or Control-click the file and select "Rename" from the menu. The filename becomes editable. Click at the end of the name and delete the current extension (the dot and the letters after it), then type the new one. Press Enter to confirm.

Mac will show a dialog asking whether you want to change the extension. Click "Use the new extension". The file is now renamed with the new extension.

When to convert instead of just renaming

straightforward renaming the extension works fine if the file's contents already match the new format. For example, if you have a text file saved as .doc but it contains only plain text, renaming it to .txt causes no problems. The same is true for many image formats — a .jpg file can usually be renamed to .png without losing anything.

But if you're changing the file to a format it wasn't originally saved in, renaming alone won't work. If you have a Word document (.docx) and rename it to .pdf, the file will be unreadable because the contents are still Word data, not PDF data. In this case, you need to convert it: open the file in Word, go to "File" > "Save As", and choose PDF from the format dropdown. This actually rewrites the file's contents in the new format.

When in doubt, use the original program's "Save As" feature. It's the only way to may provide the file's contents match the new extension.

Common extensions and what they mean

Here are the extensions you'll encounter most often when organizing files:

ExtensionFile TypeCommon Programs
.pdfPortable Document FormatAdobe Reader, Preview (Mac), any web browser
.docxMicrosoft Word documentMicrosoft Word, Google Docs
.xlsxMicrosoft Excel spreadsheetMicrosoft Excel, Google Sheets
.jpg or .jpegImage filePhotos app, Preview (Mac), any image viewer
.pngImage file with transparencyPhotos app, Preview (Mac), any image viewer
.txtPlain textNotepad (Windows), TextEdit (Mac), any text editor
.mp4Video fileWindows Media Player, QuickTime (Mac), VLC
.mp3Audio fileWindows Media Player, iTunes, Spotify

What happens if you change the extension to the wrong format

If you rename a file to an extension that doesn't match its contents, one of two things happens. Either the file won't open at all — your computer will say it doesn't recognize the format — or it will open in the program associated with that extension and display garbage or an error message.

This isn't dangerous. You haven't damaged the file; you've just mislabeled it. straightforward rename it back to the correct extension and it will work again. The original data is still there, untouched.

The only real risk is if you rename a file and then forget what the original extension was. To avoid this, keep a note of the original name before you change it, or use "Undo" (Ctrl+Z on Windows, Command+Z on Mac) when ready if something goes wrong.

Batch renaming extensions for multiple files

If you have many files that need the same extension change — for example, a folder of images all saved as .jpg that you want to rename to .png — you can rename them one at a time using the steps above, but there are faster options.

On Windows, you can select multiple files at once in File Explorer by holding Ctrl and clicking each one. Right-click and select "Rename". Type the new name and extension; Windows will rename all selected files with that name plus a number in parentheses (like "photo (1)", "photo (2)"). This works for the filename but not for changing just the extension across multiple files.

For changing only the extension on many files at once, you'll need a batch rename tool. Free options include Bulk Rename Utility (Windows) or A-Zippr (Mac). These programs let you select a folder and change the extension on every file in it at once. However, remember that this only changes the label — if the files' contents don't actually match the new format, they still won't open correctly.

Frequently Asked Questions

Can I change a file extension without losing the file?

Yes. Changing the extension only renames the label on the file; the data inside stays the same. You can change it back anytime by renaming it again. The only risk is if you change it to an extension that doesn't match the file's contents, in which case it may not open — but the file itself is not damaged.

Will changing a .jpg to .png actually convert the image?

No. Renaming a .jpg file to .png changes only the label, not the image data. The file will still be a JPEG image, just with a PNG label. Most image viewers will open it anyway because they recognize the actual format. To truly convert a JPEG to PNG, open it in an image editor like Preview (Mac) or Paint (Windows), then use "Save As" and choose PNG from the format menu.

What if I can't see the file extension on my computer?

On Windows, open File Explorer, click "View", and check "File name extensions". On Mac, open Finder, click "Finder" in the menu bar, select "Settings", go to "Advanced", and check "Show all filename extensions". After that, extensions will be visible on all your files.

Is it safe to change a file extension?

Yes, as long as you remember what the original extension was. If you change it and the file won't open, you can straightforward rename it back. The file's contents are never at risk from renaming. The only real mistake is changing it to an extension that doesn't match the file's actual format, but even that is easily fixed.

Can I change the extension of a file that's currently open?

It depends on the program. Most programs lock the file while it's open, so you won't be able to rename it until you close it. Close the file first, rename the extension, then open it again with the new extension.