What a file extension is and why you might change it

A file extension is the two to four letters at the very end of a filename, after the dot. In "document.pdf", the extension is "pdf". In "photo.jpg", it is "jpg". The extension 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 by accident, when you read something that arrived with the wrong name, or when you want to open a file in a different program. Changing the extension itself is straightforward — the tricky part is understanding when it is safe to do and when it will break the file.

The most common safe change is renaming a text file from ".txt" to ".csv" so a spreadsheet program can read it, or changing ".jpg" to ".png" to use a different image format. Changing a ".docx" file to ".pdf" will not work — that requires saving through the original program, not just renaming. This guide covers how to make the change on your device, and when that change will actually work.

Key Takeaways

  • On Windows, right-click the file, choose Rename, change the letters after the dot, and press Enter — but you may need to turn on "Show file extensions" in View settings first.
  • On Mac, select the file, press Return or Space to edit the name, change the extension, and confirm that you want to change it when prompted.
  • On Linux, right-click and rename, or use the command line with the mv command to change the extension in bulk.
  • Changing the extension only works if the file format itself is compatible — renaming a Word document to PDF will not convert it, but renaming a JPG to PNG usually will.
  • If you cannot see the extension at all, your device is hiding it by default, and you need to turn on the display setting before you can edit it.

How to change an extension on Windows

Windows hides file extensions by default, so your first step is to turn them on. Open File Explorer and look at the top menu. Click the View tab, then check the box next to "File name extensions". Now every file will show its full name including the dot and letters at the end.

Once extensions are visible, right-click the file you want to rename. Select "Rename" from the menu that appears. The filename will become editable — you will see it highlighted in a box. Use your keyboard to move to the end of the name, delete the old extension (the letters after the dot, including the dot itself), and type the new one. For example, change "document.txt" to "document.csv" by deleting "txt" and typing "csv".

Press Enter when you are done. Windows will ask you to confirm that you want to change the extension. Click "Yes" to proceed. The file is now renamed, though whether it will actually open in the new format depends on whether the file contents match the new extension — a text file renamed to ".csv" will open in Excel, but a Word document renamed to ".pdf" will not display correctly.

How to change an extension on Mac

Mac shows file extensions by default, so you can start renaming when ready. Click once on the file to select it, then press Return or Space to enter edit mode. The filename will become editable in a box. Move your cursor to the end and delete the old extension (the dot and the letters after it), then type the new extension.

When you press Enter, Mac will show a dialog asking whether you want to keep the old extension or use the new one. Choose "Use the new extension" to complete the change. If you see a warning that changing the extension may make the file unusable, read it carefully — this usually means the file format and the extension do not match, and opening it may cause problems.

If you want to hide the extension again after renaming, select the file, press Command+I to open Get Info, and check the box next to "Hide extension". This is useful if you are sharing files with others or organizing by appearance, but keeping extensions visible makes it easier to manage files correctly.

How to change an extension on Linux

Linux file managers work similarly to Mac and Windows. Right-click the file, select "Rename", and edit the name in the box that appears. Delete the old extension and type the new one, then press Enter. The file is renamed when ready without a confirmation dialog.

If you are comfortable using the command line, you can rename files in bulk using the mv command. Open a terminal, navigate to the folder containing your files, and type a command like mv oldname.txt newname.csv to rename a single file. For multiple files with the same extension, you can use a loop or a tool like rename to change them all at once — for example, rename 's/\.txt$/.csv/' *.txt will change every .txt file in the folder to .csv.

When changing an extension actually works

Changing the extension works reliably when the file format and the new extension are compatible. A text file saved as ".txt" can be renamed to ".csv" and will open correctly in Excel because both formats are plain text. A JPG image can usually be renamed to PNG because both are image formats that store the same kind of data. A Word document (.docx) can be renamed to ".txt" and will open, though it will show all the hidden formatting code alongside the readable text.

Changing the extension does not work when the file format and the new extension are incompatible. Renaming a Word document to ".pdf" will not convert it — the file will not open in a PDF reader because the data inside is still in Word format. Renaming an MP3 audio file to ".jpg" will not make it an image. The extension is just a label; changing the label does not change what is inside the file.

If you need to convert a file from one format to another — for example, from Word to PDF, or from JPG to PNG — you must save it through the original program using "Save As" or "Export", not by renaming. The program will do the actual conversion work. Renaming alone just changes the label.

What to do if you cannot see the extension

If you cannot see the extension at all when you look at your files, your device is hiding them. On Windows, open File Explorer, click View, and check "File name extensions". On Mac, select a file, press Command+I, and uncheck "Hide extension". On Linux, the method depends on your file manager — usually it is in View or Preferences, or you can use the command line to show all files including hidden ones.

Once extensions are visible, you can rename them as described above. Some people prefer to keep extensions hidden for a cleaner look, but hiding them makes it harder to manage files correctly and understand what format they are in. For organizing and troubleshooting, keeping extensions visible is usually the better choice.

Common mistakes when changing extensions

The most common mistake is changing the extension without understanding that the file format has not changed. Someone renames a Word document to ".pdf" expecting it to become a PDF, then is confused when it will not open in a PDF reader. Remember: renaming only changes the label, not the contents.

Another mistake is deleting the dot by accident. If you rename "document.txt" to "documenttxt" (without the dot), your computer will not recognize it as having an extension at all, and it may not open in any program. Always include the dot when you type the new extension.

A third mistake is changing the extension on a file you are not sure about. If you are not certain whether the file format and the new extension are compatible, make a copy of the file first, change the extension on the copy, and test whether it opens correctly. If it does not, you still have the original.

Frequently Asked Questions

Can I change a file extension and have it actually convert the file?

No. Changing the extension only changes the label on the file, not the data inside. To convert a file from one format to another — like Word to PDF or JPG to PNG — you must use the original program and choose "Save As" or "Export" with the new format. The program does the conversion work; renaming does not.

What if I change the extension and the file will not open?

The file format and the new extension do not match. Change the extension back to the original, or try a different extension that matches the actual file format. If you are not sure what format the file is in, you can try opening it with different programs to see which one works, then use that program's name as a clue to the correct extension.

Is it safe to change a file extension?

It is safe to change the extension itself — the action of renaming will not damage the file. Whether the file will work afterward depends on whether the new extension matches the file format inside. If you are unsure, make a copy first and test the renamed copy before deleting the original.

Why does my computer hide file extensions?

Windows and some Mac setups hide extensions by default to make filenames look cleaner and simpler for everyday users. This can make file management harder because you cannot see what format a file is in. Turning on the display of extensions is usually the first step when you need to rename them or understand what you are working with.

Can I change multiple file extensions at once?

On Windows and Mac, you must rename files one at a time through the graphical interface. On Linux, you can use command-line tools like rename to change the extension on many files at once with a single command. If you have many files to rename on Windows or Mac, consider using a batch rename tool, though the built-in method is safest for beginners.