Renaming a file extension is straightforward once you know where to look
A file extension is the suffix at the end of a filename — the part after the final dot. On Windows, Mac, and Linux, you can change it by renaming the file itself. The method depends on your operating system and whether you have hidden file extensions turned on. Most people can do this in under a minute using the file manager that came with their computer.
The risk is real: changing a file extension can break the file if you rename it to something the program doesn't recognize. A .jpg image renamed to .txt won't display as an image anymore. But if you know what you're doing — converting between formats, fixing a mislabeled file, or organizing files by type — renaming the extension works reliably.
Key Takeaways
- On Windows, you may need to turn off "Hide extensions for known file types" in File Explorer settings before you can edit the extension.
- On Mac, right-click the file, select "Rename", and change the extension at the end; the system will warn you if the new extension is unusual.
- On Linux, use your file manager's rename function or the command line with mv oldname.ext newname.ext to change the extension.
- Changing a file extension does not convert the file's contents — a .jpg renamed to .png is still a JPEG image, just with a misleading label.
- Some programs lock files while they're open, so close the file in its original program before renaming the extension.
How to rename a file extension on Windows
Windows hides file extensions by default, so your first step is to show them. Open File Explorer, click the View tab at the top, and check the box next to "File name extensions". Now you'll see the full filename including the dot and extension.
Right-click the file you want to rename and select "Rename" from the menu. The entire filename, including the extension, becomes editable. Change only the part after the final dot — for example, change photo.jpg to photo.png. Press Enter. Windows will ask if you're sure you want to change the extension; click "Yes" to confirm.
If you don't see the "File name extensions" option in the View tab, you're using an older version of Windows. Instead, open File Explorer, click Tools in the menu bar, select Folder Options, click the View tab, and uncheck "Hide extensions for known file types".
How to rename a file extension on Mac
On Mac, file extensions are usually hidden by default, but you can still rename them. Click the file once to select it, then press Enter or click it again slowly (not a double-click). The filename becomes editable. Change the extension at the end — for example, change document.txt to document.md.
When you press Enter, 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. If you want to see extensions all the time, open Finder, click Finder in the menu bar, select Preferences, click the Advanced tab, and check "Show all filename extensions".
How to rename a file extension on Linux
Linux file managers vary, but most work the same way as Mac. Right-click the file and select "Rename" or "Edit Name". The filename becomes editable in place. Change the extension and press Enter to save the change.
If you prefer the command line, open a terminal and use the mv command. Type mv oldfilename.ext newfilename.ext and press Enter. For example: mv photo.jpg photo.png. The file is renamed immediately with no confirmation dialog.
What happens when you rename a file extension
Renaming the extension changes only the label, not the file's actual contents. If you rename a .jpg image to .png, the file is still a JPEG image internally — it just has a misleading label. When you try to open it, the program may refuse to open it, or it may open it anyway if the program is flexible about file types.
Some programs check the extension to decide how to handle the file. Others check the file's internal structure (called the "magic number" or file signature). This is why renaming a .jpg to .txt doesn't turn it into text — the file still contains image data, and most text editors will refuse to open it or will display garbage.
If you want to actually convert a file from one format to another — for example, turning a JPEG into a PNG — you need to open it in an image editor and export it in the new format. Renaming the extension alone won't do that.
When renaming a file extension causes problems
The most common problem is renaming a file to an extension the program doesn't recognize. If you rename a Word document from .docx to .txt, Word may refuse to open it. The file still contains the original data, but the program sees the wrong extension and assumes it's the wrong type.
Some programs lock files while they're open, which prevents you from renaming them. Close the file in its original program first, then rename the extension. If you get an error saying the file is in use, check your taskbar or open programs and close the one that has the file open.
System files and hidden files can sometimes be renamed, but doing so can break your operating system. Avoid renaming anything in Windows\System32, /System, or /etc unless you know exactly what you're doing.
Renaming multiple file extensions at once
If you need to rename dozens of files, doing them one at a time is slow. Windows, Mac, and Linux all have batch rename tools. On Windows, select multiple files in File Explorer, right-click, and choose "Rename". Type a new name and Windows will rename all of them with a number added to each one — for example, "photo (1)", "photo (2)", "photo (3)". This renames the filename but not the extension.
For more control, use a dedicated batch rename tool. On Windows, Bulk Rename Utility is free and lets you change extensions for multiple files at once. On Mac, Rename from the App Store does the same thing. On Linux, the command line is often faster: for f in *.oldext; do mv "$f" "${f%.oldext}.newext"; done will rename all files with the old extension to the new one.
Frequently Asked Questions
Can I rename a file extension without breaking it?
Yes, if you're renaming it to an extension the program recognizes. Renaming a .jpg to .jpeg works fine because both are JPEG formats. Renaming a .jpg to .txt will make the file unreadable by most programs, even though the image data is still there. The key is knowing whether the new extension matches what's actually inside the file.
What if I rename a file and can't open it anymore?
Rename it back to the original extension. Right-click the file, select Rename, and change the extension back to what it was. The file's contents haven't changed, so it should open normally once the extension matches the file type again.
Do I need special software to rename file extensions?
No. Your operating system's built-in file manager handles it. You only need special software if you want to rename many files at once or if you want more control over the naming pattern.
Why does Windows hide file extensions by default?
Microsoft hides extensions to make filenames simpler for casual users. The downside is that you can't see or edit them without changing a setting. Turning on "Show file name extensions" is safe and makes file management easier.
Can I rename a file extension to something that doesn't exist?
Yes, technically. You can rename a file to .xyz or .custom and the operating system won't stop you. But no program will recognize the extension, so you won't be able to open the file by double-clicking it. You'd have to open the program first and then open the file from within it.