You can change a file extension by renaming the file to end with a different three or four-letter code
A file extension is the short code at the end of a filename — like .txt, .jpg, or .pdf — that tells your computer what program should open it. Changing an extension is as simple as renaming the file, but the method depends on whether your operating system is hiding extensions from you. On Windows and Mac, extensions are often hidden by default, so you need to turn that setting on first. On Linux, extensions are usually visible, and you can rename the file directly.
Changing an extension does not automatically convert the file to a new format. A .jpg image renamed to .png will still be a jpg file that most programs will refuse to open. The extension is just a label. If you need to actually convert a file from one format to another, you need conversion software or an online tool designed for that specific pair of formats.
Key Takeaways
- On Windows, open File Explorer, go to View, and check the box for "File name extensions" to see the full filename including the extension.
- On Mac, select the file in Finder, press Command+I to open Get Info, uncheck "Hide extension", and then rename the file.
- On Linux, most file managers show extensions by default, so you can right-click the file and select Rename to change it immediately.
- Changing only the extension does not convert the file's contents — a renamed .jpg is still a jpg file and will not open as a .png.
- Some file types are protected by your operating system and cannot be renamed without administrator permission or a warning dialog.
How to show file extensions on Windows
By default, Windows hides file extensions to make filenames look cleaner. To see and change them, you need to turn on the "File name extensions" setting in File Explorer.
Open File Explorer and click the View tab at the top. Look for a checkbox labeled "File name extensions" and click it to turn it on. From now on, every file in File Explorer will show its full name including the extension. You only need to do this once — the setting stays on until you turn it off again.
Once extensions are visible, right-click the file you want to rename, select Rename, and type the new name with the new extension. For example, change document.txt to document.pdf. Press Enter when you are done. Windows may show a warning asking if you are sure you want to change the extension — click Yes to confirm.
How to show file extensions on Mac
Mac hides extensions by default, but you can unhide them for individual files or turn off the setting globally. The quickest way for a single file is to use the Get Info window.
Select the file in Finder, then press Command+I (or right-click and choose Get Info). A window will open showing the file's details. Look for a checkbox labeled "Hide extension" and uncheck it. Close the Get Info window. The extension will now be visible in the filename.
Now right-click the file and select Rename, or click the filename once to edit it directly. Type the new name with the new extension and press Enter. If you want extensions to stay visible for all files going forward, open Finder Preferences, click the Advanced tab, and check "Show all filename extensions".
How to change extensions on Linux
Most Linux file managers show extensions by default, so you can rename files immediately without changing any settings. Open your file manager (such as Files, Nautilus, or Dolphin), find the file you want to rename, and right-click it.
Select Rename from the menu. The filename will become editable. Type the new name with the new extension and press Enter. Some file managers also let you click the filename once to edit it directly without right-clicking.
If your file manager does not show extensions, open the View menu and look for an option to show hidden files or file details. The exact wording varies by file manager, but the principle is the same.
When changing an extension does not work
If you rename a file but it still opens with the wrong program, or if it will not open at all, the problem is usually that the file's actual format does not match its new extension. The extension is just a label — changing it does not change what the file actually contains.
For example, if you have a .jpg image and rename it to .png, your computer will try to open it as a PNG file, but the data inside is still JPEG data. Most programs will refuse to open it or will show an error. To actually convert a file from one format to another, you need to use a program designed for that conversion, such as an image editor for photos or a document converter for text files.
Some operating systems also protect certain file types. On Windows and Mac, system files and executable programs (.exe, .app, .dmg) may show a warning or require administrator permission before you can change their extensions. This is a safety feature to prevent accidental damage to your system.
Common file extensions and what they mean
| Extension | File Type | Common Programs |
|---|---|---|
| .txt | Plain text | Notepad, Word, TextEdit |
| Portable Document Format | Adobe Reader, Preview, Firefox | |
| .jpg or .jpeg | JPEG image | Photos, Preview, any image viewer |
| .png | PNG image | Photos, Preview, any image viewer |
| .docx | Microsoft Word document | Microsoft Word, Google Docs, LibreOffice |
| .xlsx | Microsoft Excel spreadsheet | Microsoft Excel, Google Sheets, LibreOffice |
| .mp3 | Audio file | Media Player, iTunes, VLC |
| .mp4 | Video file | Media Player, VLC, QuickTime |
| .zip | Compressed archive | File Explorer, Archive Utility, 7-Zip |
Frequently Asked Questions
Will changing a file extension break the file?
Changing only the extension does not break the file's data. However, if you change it to an extension that does not match the file's actual format, programs may refuse to open it or display an error. The file itself is unchanged — only the label is different.
Can I change a file extension on a Mac without using Get Info?
Yes. Go to Finder Preferences, click Advanced, and check "Show all filename extensions". After that, all files will show their extensions, and you can rename them the same way you would on Windows — right-click, select Rename, and type the new name with the new extension.
What if my file manager does not show extensions?
Look in the View menu of your file manager for an option to show file details, show hidden files, or display full filenames. The exact wording depends on which file manager you are using. If you cannot find it, you can also open a terminal and use the mv command to rename the file directly.
Can I change multiple file extensions at once?
Most file managers do not have a built-in batch rename feature, but some third-party tools do. On Windows, you can select multiple files, right-click, and choose Rename, but this usually only changes the first file. For bulk renaming, search for "batch rename tool" for your operating system.
Does changing a .jpg to .png actually convert the image?
No. Renaming a .jpg to .png only changes the label. The image data inside is still JPEG format. To actually convert an image from one format to another, use an image editor like Photoshop, GIMP, or an online converter, and save the file in the new format.