What a file extension is and why you might change it
A file extension is the short code at the end of a filename that tells your computer what kind of file it is. It comes after the dot — the .jpg in photo.jpg, the .docx in letter.docx, the .mp3 in song.mp3. Your operating system uses this code to decide which program opens the file when you double-click it.
You might need to change an extension when you save a file in a different format, when a file loses its extension by accident, or when you want a different program to open it. For example, if you export a photo from an editing program and it saves as .png but you need .jpg, you can change the extension. Or if you read a file that arrives as .txt but should be .csv to open in a spreadsheet program, renaming the extension fixes it.
Changing the extension itself is straightforward — it is just renaming part of the filename. But it only works if the file is actually in that format underneath. Renaming photo.jpg to photo.png does not convert the image; it just tells your computer to treat it as a PNG, which usually fails. The file has to actually be in the format you are claiming it is.
Key Takeaways
- File extensions are the three or four letters after the dot in a filename, and they tell your computer which program should open the file.
- On Windows, you need to turn on "Show file extensions" in File Explorer settings before you can see and edit them.
- On Mac, right-click the file, choose "Get Info", and change the extension in the filename field at the top.
- Changing the extension only works if the file is actually in that format — renaming a JPG to PNG does not convert it.
- If you need to convert a file to a different format, use the original program that created it or a conversion tool, not just a rename.
How to change extensions on Windows
Windows hides file extensions by default, so the first step is to turn them on. Open File Explorer (the folder icon on your taskbar), then click the "View" tab at the top. Look for a checkbox labeled "File name extensions" and click it. Now you will see the full filename including the extension on every file.
Find the file you want to rename, right-click it, and choose "Rename". The entire filename, including the extension, will be highlighted and ready to edit. Change only the extension part — the letters after the final dot. For example, change document.txt to document.csv. Press Enter when you are done. Windows will ask if you are sure you want to change the extension; click "Yes".
If you do not see the "File name extensions" checkbox in the View tab, you may be using an older version of Windows. In that case, right-click the file, choose "Rename", and edit the extension the same way. The checkbox location varies slightly between Windows 10 and Windows 11, but the principle is identical.
How to change extensions on Mac
On Mac, extensions are usually hidden too, but you do not need to turn on a global setting. Instead, right-click the file you want to rename and choose "Get Info" from the menu. A window will open showing details about the file.
At the top of the Get Info window, you will see the filename in an editable field. Click in that field and change the extension at the end. For example, change image.jpg to image.png. When you click outside the field or press Enter, Mac will ask if you are sure you want to change the extension. Click "Use the new extension".
If you want to see extensions on all files in Finder without opening Get Info each time, you can turn on the global setting: open Finder, click "Finder" in the menu bar, choose "Settings", go to the "Advanced" tab, and check "Show all filename extensions". After that, you can rename files the same way you do on Windows — right-click, choose "Rename", and edit the extension directly.
How to change extensions on Linux
Linux file managers vary depending on which desktop environment you use, but the principle is the same. In most file managers — including Nautilus (GNOME), Dolphin (KDE), and Thunar (Xfce) — extensions are visible by default. Right-click the file and choose "Rename" or press F2 with the file selected.
Edit the filename and change the extension at the end. Press Enter to confirm. Some Linux file managers will warn you that changing the extension may make the file unusable; this is the same warning Windows and Mac show. Click "Rename" or "Proceed" to confirm.
If you are working in a terminal instead of a graphical file manager, use the mv command to rename the file. For example, mv oldname.txt newname.csv renames the file and changes the extension. The terminal does not warn you or ask for confirmation — it straightforward renames the file when ready.
When changing the extension actually works
Changing the extension works when the file is already in the format you are renaming it to. If you export a document as a PDF from Microsoft Word, the file is genuinely a PDF underneath — it just has a .doc extension by mistake. Renaming it to .pdf makes it open correctly. The same is true if you read a spreadsheet that arrives as .txt but is actually comma-separated values (CSV) format inside.
Changing the extension does not work as a conversion tool. If you have a JPG image and rename it to .png, your computer will try to open it as a PNG and fail, because the file is still JPG data inside. To actually convert a file from one format to another, you need to use the program that created it — export from Word as PDF instead of renaming a .doc file, or use an image editor to export a JPG as PNG.
The safest approach: if you are unsure whether the file is actually in the format you want, do not rename the extension. Instead, open the file in the program that created it and use "Export As" or "Save As" to save it in the format you need. This guarantees the conversion happens correctly.
What happens if you change the extension wrong
If you rename a file to an extension it is not actually in, the file will not open. Double-clicking it will either produce an error message or open it in the wrong program, which will show garbage or a corrupted preview. The file itself is not damaged — you can always rename the extension back to what it was before.
If you accidentally change the extension of an important file, undo the rename when ready by right-clicking, choosing "Rename" again, and changing it back. As long as you have not closed the file manager, you can usually undo the rename using Ctrl+Z (Windows and Linux) or Command+Z (Mac).
Some files do not show an extension at all — these are usually system files or files without a recognized extension. Do not rename these unless you are certain what you are doing. If a file has no extension and you want to add one, the same rename process applies: right-click, rename, add the extension you want, and press Enter.
Common extensions and what they mean
Knowing what extension a file should have helps you rename correctly. Image files use .jpg, .png, .gif, and .bmp. Documents use .pdf, .docx, .txt, and .xlsx. Audio files use .mp3, .wav, and .flac. Video files use .mp4, .mov, .avi, and .mkv. Compressed files use .zip and .rar. Web files use .html and .css.
If you are not sure what extension a file should have, search for the program name plus "file format" — for example, "Photoshop file format" will tell you that Photoshop uses .psd. Or right-click the file, choose "Open With", and look at which programs are listed; the extension usually matches the program name or the format it supports.
Frequently Asked Questions
Can I change a file extension to make it open in a different program?
Only if the file is actually in that format. If you have a text file and rename .txt to .csv, it will open in a spreadsheet program, but the spreadsheet will probably not read it correctly unless the text is already formatted as comma-separated values. If you want a different program to open a file by default, right-click it, choose "Open With" or "Get Info", and select the program you prefer — you do not need to change the extension.
What if I change the extension and the file will not open?
Rename the extension back to what it was before. If you cannot remember the original extension, right-click the file, choose "Properties" (Windows) or "Get Info" (Mac), and look at the file type listed there. That will tell you what the extension should be. Then rename it back and try again.
Do I need to change the extension if I save a file in a different format?
No. When you use "Save As" or "Export As" in a program, the program automatically saves the file in the new format and gives it the correct extension. You only need to change the extension manually if the file arrives with the wrong one or if you are renaming a file that is already in the format you want.
Can I have a file with no extension?
Yes. Files do not require extensions to exist or to work. On Mac and Linux, many system files have no extension. On Windows, files without extensions may not open when you double-click them, but they still exist and can be opened by dragging them into a program. If you want to remove an extension, just delete it from the filename during rename.
Is it safe to change file extensions?
It is safe to rename the extension of a file you created or downloaded, as long as you remember what the original extension was. The worst that happens is the file will not open, and you can rename it back. Do not change extensions on system files or files you do not recognize, as this can cause programs to malfunction.