It `s important to note that changing the file extension (now we're going to see different ways of doing this), it doesn't change the file type. Therefore, if you change the extension of an image file making it look like a text file, the system will try to open it with the program that opens text files, but giving an error and considering it unreadable.
Change file extension it is, therefore, a delicate operation that requires attention, but which is nevertheless important to know how to do for save the files so they can be opened with the right program and more appropriate. There are different ways of changing file extensions, so let's see which ones are simpler and at hand.
Save a file with a different extensionThe following procedure applies to any type of file and is safe because it allows change the extension of a file without being able to make mistakes.
- Open a file in its default program (for example a .jpg text file with the Irfanview viewer).
- Click on the File menu and click on Save As.
- Choose the folder where to save the file and give it a name.
- In the Save As dialog box, below the box where you type the name, you will find a drop-down menu labeled Save as that shows a list of all the file types that can save the program you are using (if you are using Irfanview, this will be able to save an image in all common image formats, for example a JPG can be saved as a .png, .webp, .bmp file etc.)
- The original file will not be modified and in this case a copy of that file will be created with a different extension.
Rename the file to change extensionA file's extension is found in its name, but it is hidden by default. To discover it and make it visible, in Windows 10, open any folder and then press the View menu at the top. In the menu that opens, look for theoption Extensions file names and activate it. Note that this option would be better then deactivate it as soon as you are done with the changes, because leaving it activated you run the risk of inadvertently changing the extension of a file every time you try to rename it).
At this point the filenames will all be displayed with a period and extension, for example foo.txt or convertresources.html.
To change the extension, just right click on the file, go to rename and change the part to the right of the point. Before saving the change, Windows 10 will ask for confirmation, informing you that the file extension has been changed and that the file may no longer be usable.
In reality, in case of errors, you can always return the extension by putting the real one. We have seen in another article how to do it if a file does not open because the extension is unknown or if it uses the wrong program.
Change the extension of all files in a folderIf you need to change the extension of all files of a certain type within a folder, you need to open the command prompt. From the Start menu, search for cmd and open the Windows 10 command prompt. If we need to enter a specific folder on the command prompt, it is better to right-click on that folder while holding down the Shift key and then select Open command prompt from here or Open Powershell window from here.
The commands to use to change extension are as follows:
REN foo.txt foo.html (change the txt file named foo to an html file)
REN * .txt * .html (change all folder txt files to html files)
If you want to change the extensions of several files together, you can also use a program like Bulk Extension Changer which makes everything easier.
When it may be necessary to change file extensionsIt is usually not necessary to change extension to files, except in some specific cases, such as:
- You can break down a file generated by an Office program such as Word or Excel into its elements by changing the file extension from .docx or .xlsx to .zip.
- You can change the extension of a system file to save a copy intact in case you make changes (as seen, for example, for the trick that allows you to enter Windows without a password).
- Convert the format of an image file, which must be done using the viewer program as seen in the first point.
- Convert video to a different format (eg .mp4) or audio file (.mp3); to do this, however, you need a program to convert video.
Finally, remember that it is possible to associate a program to a particular file according to its extension. We have seen how to do it in the guide above how to change program to open a file in windows.