You can change a file's extension by renaming it, but the file type itself may not change
A file extension is the short code at the end of a filename — the .txt in document.txt or the .jpg in photo.jpg. Changing the extension is straightforward: you rename the file and swap out those letters. On Windows, Mac, and Linux, you can do this by right-clicking the file and selecting rename, then typing a new extension.
The important thing to understand is that changing the extension does not automatically change what the file actually is. If you rename photo.jpg to photo.txt, the file is still a photo — you have just told your computer to treat it differently. Some programs will refuse to open it, or it will open in the wrong program. The file's actual contents have not changed.
There are legitimate reasons to change extensions: you might need to convert a file format, work around a program that expects a certain extension, or fix a file that lost its extension. This guide covers how to do it safely and what to expect.
Key Takeaways
- Renaming a file's extension is done by right-clicking, selecting rename, and typing a new extension — the process is the same on Windows, Mac, and Linux.
- Changing the extension does not change what the file actually is; a photo renamed to .txt is still a photo and may not open correctly.
- Windows hides extensions by default, so you may need to turn on "Show file extensions" in your folder settings before you can rename one.
- If you want to truly convert a file from one format to another, you need conversion software or an online converter, not just a rename.
- Always keep a copy of the original file before changing its extension, in case the new extension does not work with the programs you need.
How to show file extensions on Windows
Windows hides file extensions by default, so you may not see the .docx or .mp4 at the end of your filenames. To change an extension, you usually need to see it first.
Open File Explorer and look at the top menu. Click the View tab. In the ribbon that appears, check the box next to File name extensions. From now on, you will see the full filename including the extension for every file in that folder and subfolders.
If you are using an older version of Windows, the View menu may look different. Look for an option called Options or Folder Options, click it, go to the View tab, and uncheck the box that says Hide extensions for known file types. Click Apply and OK.
How to rename a file extension on Windows
Once you can see extensions, right-click the file you want to rename. Select Rename from the menu that appears. The filename will become editable — you will see a text box with the full name highlighted.
Type the new filename and extension. For example, if the file is document.docx and you want to change it to document.txt, type exactly that. Press Enter when you are done. Windows will ask you to confirm the change because it recognizes you are changing the extension. Click Yes.
The file now has a new extension. Whether it will open correctly depends on what the file actually contains and whether your programs recognize the new extension.
How to rename a file extension on Mac
Mac shows file extensions by default in most cases, so you can usually see them right away. If you do not see the extension, click the file once to select it, then press Command + I to open the info window. Look for a field called Name & Extension — the extension is shown separately there.
To rename the extension, click the file once to select it and press Enter. The filename becomes editable. Type the new name and extension — for example, photo.png instead of photo.jpg — and press Enter again. Mac will ask if you want to use the new extension. Click Use the new extension.
Alternatively, open the info window with Command + I, click in the Name & Extension field, and type the new extension directly there. This method is useful if you want to change only the extension and keep the filename the same.
How to rename a file extension on Linux
Linux file managers show extensions by default. To rename a file, right-click it and select Rename from the context menu. The filename becomes editable in place. Type the new name and extension, then press Enter.
If you are using the terminal, you can use the mv command. Type mv oldname.oldextension newname.newextension and press Enter. For example: mv photo.jpg photo.png. The file is renamed immediately with no confirmation prompt.
Linux does not warn you when you change an extension the way Windows and Mac do, so be careful to type the new extension correctly.
When renaming an extension actually converts a file
Renaming alone does not convert a file from one format to another. However, some file types are actually just containers for other formats, and renaming them can make them work in a different program.
For example, .docx files (Microsoft Word) are actually compressed folders containing XML code. If you rename a .docx to .zip, you can open it with a zip program and see the contents. The file structure is the same; you have just told your computer to treat it as a zip archive instead of a document. This works because the underlying format is actually a zip file.
For most other file types — photos, videos, audio files, PDFs — renaming the extension does not change the actual data inside. A .jpg photo renamed to .png is still a JPEG photo. It may open in a program that expects PNG files, but the image data has not been converted. To truly convert formats, you need conversion software or an online converter tool.
Why a file might not open after you change its extension
When you rename a file's extension, the program you use to open it depends on what extension it now has. If you rename song.mp3 to song.txt, your computer will try to open it with a text editor instead of a music player. The text editor will show garbage characters because it is trying to read music data as text.
Some programs are flexible and will open a file regardless of its extension if you drag it onto them or use Open With. Others refuse to open anything that does not have the extension they expect. If a file will not open after you rename it, try right-clicking it, selecting Open With, and choosing a different program from the list.
If the file still will not open, the extension change may have broken something. This is why it is important to keep a backup of the original file before you rename it. You can always rename it back to the original extension and try a different approach.
Frequently Asked Questions
Can I change a file extension to make it open in a different program?
Sometimes. If you rename a file to an extension that a program recognizes, that program may open it. However, the file's actual contents do not change, so the program may not be able to read it correctly. This works best when the underlying file format is the same but the extension is wrong — for example, a photo that was saved as .jpg but should be .jpeg.
What happens if I change the extension of a program or system file?
Changing the extension of a program file (like .exe on Windows or .app on Mac) can break it. Your computer uses the extension to know how to run the file. Only change extensions on files you created or downloaded, not on programs or system files.
Can I remove the extension entirely?
Yes, you can rename a file to have no extension at all — for example, renaming document.txt to just document. However, programs will have a harder time opening it because they rely on the extension to know what type of file it is. Most of the time, keeping an extension is better.
Do I need special software to change a file extension?
No. The rename function built into Windows, Mac, and Linux is all you need. You do not need to download anything. If you want to convert a file from one format to another (not just rename it), then you may need conversion software, but that is a different process.
Will changing the extension affect the file size?
No. The file size stays exactly the same when you rename the extension. You are only changing the label on the file, not the data inside it.