You can change a file extension by renaming the file, but the file type itself stays the same
A file extension is the two to four letters after the dot at the end of a filename — like .txt, .jpg, or .pdf. Changing the extension is straightforward: you rename the file and type a new extension. But here is the important part: renaming the extension does not change what the file actually is. If you rename a photo from image.jpg to image.txt, your computer will still treat it as a photo. You are just telling your computer to stop recognizing it as one.
Most of the time, you change an extension because you want a program to open the file differently, or because you are moving a file to a system that needs a different format. Sometimes you need to change it because the file was saved with the wrong extension by accident. The steps are the same on all three major operating systems, though the menus look different.
Key Takeaways
- Changing a file extension means renaming the file to end with a different three or four letter code, but the actual file content does not change.
- On Windows, right-click the file, choose Rename, change the letters after the dot, and press Enter.
- On Mac, select the file, press Return (not Enter), change the extension, and confirm that you want to change it.
- Some files are locked against renaming — check the file properties to see if you have permission to edit the name.
- If a program will not open the file after you change the extension, the file format itself may not be compatible with that program, and changing the name back will not fix it.
How to change a file extension on Windows
Right-click the file you want to rename. A menu will pop up. Click the word "Rename" near the bottom of that menu. The filename will now be highlighted and ready to edit.
Find the dot and the letters after it. Delete those letters and type the new extension you want. For example, if the file is called "document.docx" and you want it to be "document.txt", delete "docx" and type "txt" so it reads "document.txt". Do not delete the dot itself — keep that in place.
Press Enter on your keyboard. Windows will ask you to confirm that you want to change the extension. Click "Yes". The file is now renamed.
How to change a file extension on Mac
Click the file once to select it. Press the Return key (the key that says "return" or has an arrow pointing left, not the number pad). The filename will become editable, with the entire name highlighted.
Type the new filename with the new extension. You can type over the old name completely. For example, type "document.txt" to replace "document.docx". Mac will automatically select just the filename part (not the extension) when you first press Return, but if you type a full new name with a dot and extension, it will use what you typed.
Press Return again. Mac will show a dialog asking whether you want to keep the old extension or use the new one. Click "Use the new extension" to confirm the change.
How to change a file extension on Linux
Open the file manager and navigate to the folder where the file is located. Right-click the file and look for an option called "Rename" — the exact wording depends on which file manager you are using, but it is usually in the context menu.
The filename will become editable. Find the dot and the extension after it. Delete the old extension and type the new one. Keep the dot in place. Press Enter to confirm.
If you are using the command line instead of a file manager, use the mv command: type mv oldname.oldext newname.newext and press Enter. For example, mv document.docx document.txt will rename the file.
When you cannot change the extension
Some files are locked against editing. This usually happens because you do not have permission to modify the file, or because the file is in use by another program. If you try to rename a file and nothing happens, or you see an error message, the file is probably locked.
On Windows, right-click the file, click "Properties", and look at the bottom of the window. If you see a checkbox that says "Read-only", check whether it is marked. If it is, uncheck it and click "explore", then "OK". Now try renaming the file again.
On Mac, click the file once, press Command and I together (or right-click and choose "Get Info"), and look for a section called "Sharing & Permissions". At the bottom, make sure your username shows "Read & Write" rather than "Read only". If it says "Read only", click the lock icon at the bottom right, enter your password, and change the permission.
On Linux, use the command chmod u+w filename to give yourself write permission, then try renaming again.
What happens after you change the extension
Your computer will now try to open the file with whatever program is set as the default for that new extension. If you changed a .jpg to a .txt, your computer will try to open it with a text editor instead of a photo viewer. The file itself has not changed — it is still a photo — but your computer is now confused about what it is.
If the program cannot read the file, you will see an error message or the file will open as gibberish. This does not mean the file is broken. It means the program you chose does not understand that file format. You can change the extension back to the original, and the file will work again.
If you actually need to convert a file from one format to another — for example, from .docx to .pdf — you cannot do that by changing the extension. You have to open the file in the original program and use the "Save As" or "Export" option to save it in the new format. Changing the extension alone will not convert the file.
Why file extensions matter for organizing
File extensions help you and your computer understand what a file is at a glance. When you organize files into folders by type — documents in one folder, photos in another, spreadsheets in a third — the extensions make it straightforward to spot files that are in the wrong place. A .jpg file sitting in your Documents folder stands out when ready.
Extensions also let you search for files by type. On Windows, you can search for "*.jpg" to find all photos. On Mac, you can use Spotlight to search for "kind:image" to find all image files. These searches rely on the extension being correct. If you have renamed all your photos to .txt, these searches will not find them.
Keeping extensions consistent also makes it easier to back up and move files. Cloud storage services and external drives sometimes have trouble with files that have unusual or missing extensions. A properly named file with the right extension will transfer and sync more reliably.
Frequently Asked Questions
Can I remove the extension entirely?
Yes, you can rename a file to have no extension at all — for example, changing "document.txt" to just "document". Your computer will no longer know what program to use to open it, so you will have to right-click and choose "Open with" and pick a program manually every time. Most people keep the extension in place for this reason.
Will changing the extension damage the file?
Changing the extension does not damage the file itself. The actual data inside stays exactly the same. If you change the extension back to the original, the file will work normally again. The only risk is that you might forget what the original extension was, so write it down before you change it if you are unsure.
What if I change a .exe file to a different extension?
A .exe file is a program. If you change the extension, Windows will no longer recognize it as a program and will not run it. You can change the extension back and it will work again. Do not change the extensions of program files unless you have a specific reason and understand what you are doing.
Can I change multiple file extensions at once?
On Windows and Mac, you can select multiple files at once and rename them together using batch rename tools, but the built-in rename function only works on one file at a time. On Linux, you can use a command like rename 's/\.old/\.new/' *.old to change all files with the .old extension to .new at once. Third-party batch rename programs are available for all three systems if you need to rename many files.
Why does my file still not open after I changed the extension?
The file format itself may not be compatible with the program you are trying to use. For example, if you change a .docx file to .pdf, a text editor will not be able to read it because the file is still in Word format inside — only the name changed. You need to actually convert the file using the original program's export or save function, not just rename it.