What changing a file extension does
A file extension is the short code at the end of a filename — the .txt in document.txt, the .jpg in photo.jpg, the .pdf in invoice.pdf. Changing it tells your computer to treat the file as a different type. This is useful when you need to open a file in a different program, convert between formats, or fix a file that has the wrong extension attached to it.
On Windows and Mac, file extensions are usually hidden by default. Before you can change one, you need to make extensions visible. Once you do, changing an extension is as simple as renaming the file — but the consequences depend on what you're changing and why. A photo file renamed from .jpg to .png will still open as a photo. A document renamed from .docx to .txt will open, but may lose formatting. A program file renamed from .exe to .txt will not run at all.
Key Takeaways
- File extensions are hidden by default on Windows and Mac, so you must turn on "show file extensions" in your settings before you can change them.
- Changing an extension only changes the label — it does not convert the file itself, so renaming a Word document to .pdf will not make it a real PDF.
- Some extensions are protected by your operating system and cannot be changed without extra steps, particularly executable files like .exe on Windows.
- The safest approach is to make a copy of the file before changing its extension, so you keep the original if something goes wrong.
How to show file extensions on Windows
Open File Explorer and look at the top menu bar. Click the View tab. In the ribbon that appears, look for a checkbox labeled File name extensions — it may be on the right side of the ribbon. Click it to turn it on. From now on, every file will show its extension.
If you are using an older version of Windows, the steps are slightly different. Open File Explorer, click Tools in the menu bar, then Folder Options. Click the View tab. Scroll down until you see Hide extensions for known file types. Uncheck that box and click Apply, then OK.
How to show file extensions on Mac
Open Finder and click Finder in the menu bar at the top left. Click Settings (or Preferences on older versions). Click the Advanced tab. Check the box next to Show all filename extensions. Close the window. File extensions will now be visible on all your files.
Once you have turned on extensions, you will see them on every file in Finder from that point forward. This setting stays on until you turn it off again, so you only need to do this step once. If you ever want to hide extensions again, follow the same steps and uncheck the box.
How to change a file extension
Once extensions are visible, right-click the file you want to change. Select Rename (on Mac, you may need to press Enter after clicking the file name). The filename will become editable. Find the period and the letters after it — that is the extension. Change only those letters to the new extension you want. For example, change document.docx to document.pdf or photo.jpg to photo.png. Press Enter when you are done.
Your computer may show a warning asking if you are sure you want to change the extension. This is a safety feature. Click Yes or Continue to confirm. The file extension is now changed. The file itself has not been converted — only the label has changed. Whether the file will open and work correctly in its new format depends on what you are changing and why.
When changing an extension does not work the way you expect
Renaming a file does not actually convert it. If you have a Word document (.docx) and rename it to .pdf, it is still a Word document inside — it just has a PDF label. When you try to open it, your computer will be confused because the contents do not match the label. The file may not open at all, or it may open in the wrong program and look broken.
True conversion requires a different tool. To convert a Word document to PDF, you need to use Word itself (File > Save As > PDF) or an online converter. To convert a photo from JPG to PNG, you need image software like Paint or Preview. Changing the extension alone is not enough. Before you rename a file, think about whether you are just relabeling it or whether you actually need to convert it to a different format.
Making a backup before you change an extension
If you are not sure what will happen when you change an extension, make a copy of the file first. Right-click the file, select Copy, then right-click in the same folder and select Paste. You will now have two copies — the original and a duplicate. Change the extension on the duplicate and test it. If something goes wrong, you still have the original file unchanged.
This is especially important if you are changing the extension of a file you use regularly or one that contains important information. A few seconds spent making a copy can save you from losing work or breaking something you need. You can always delete the duplicate later once you confirm the renamed version works the way you want.
Why some extensions cannot be changed easily
Windows protects certain file types for safety reasons. Executable files — programs that run code, like .exe, .bat, or .cmd files — are harder to rename because changing them could accidentally launch a program or cause security problems. If you try to change an executable file's extension, Windows may block you or ask for administrator permission.
If you need to change a protected file type, right-click it and select Properties. Look for a button that says Change next to the file type. This opens a list of programs you can choose from. You can also try right-clicking and selecting Open with to pick a specific program, which tells your computer to treat the file as that type without actually changing the extension.
Frequently Asked Questions
Can I change a file extension to make it open in a different program?
Changing the extension will make your computer try to open it with a different program, but it will not change what is actually inside the file. If the file's contents do not match the new extension, it may not open correctly or may look broken. This works best when converting between similar formats, like .jpg to .png, where the content is the same but the format is different.
What happens if I change a file extension by accident?
Change it back. Right-click the file, select Rename, and type the correct extension. Your computer will ask if you are sure — click Yes. The file will return to normal. If you are not sure what the correct extension was, look in your Recycle Bin or Trash to see if you can find the original filename.
Do I need to change extensions for files I download from the internet?
Usually not. Downloaded files come with the correct extension already attached. If a downloaded file has the wrong extension, it may be mislabeled by the website or corrupted during download. Before changing it, try opening it with the program you expect it to work with. If that fails, then consider changing the extension.
Can changing a file extension damage my computer?
Changing an extension on a regular file like a document or photo will not damage your computer. The file may not open or may look wrong, but your system will not be harmed. Changing extensions on system files or executable programs is riskier and can cause problems, so avoid changing those unless you know exactly what you are doing.
What is the difference between changing an extension and converting a file?
Changing an extension is just renaming the label — the file's contents stay the same. Converting a file actually transforms it from one format to another using a program or tool. To truly convert a Word document to PDF, you must use Word's Save As feature or a converter. Simply renaming the extension will not do it.