The quickest way to change a file extension
The fastest method depends on your operating system. On Windows, right-click the file, select Rename, and change the letters after the final period — for example, change document.txt to document.pdf. On Mac, select the file, press Return (or Enter), edit the extension, and click Change when prompted. On Linux, open a terminal, type mv oldname.txt newname.pdf, and press Enter.
The file extension is the two to four letters after the period at the end of a filename. It tells your computer what program should open the file. Changing the extension does not convert the file's contents — it only changes which program tries to open it. A renamed image file will not become a document just because you changed the extension to .doc.
Key Takeaways
- On Windows, right-click the file, select Rename, and edit the letters after the period; you may need to show file extensions first in Folder Options.
- On Mac, select the file and press Return to rename it, then change the extension and confirm the change.
- On Linux, use the mv command in a terminal to rename the file and change its extension.
- Changing an extension does not convert a file's contents — a renamed image will not become a document unless you actually convert it with the right software.
- Some programs lock file extensions to prevent accidental changes; if you cannot edit the extension, check the file's properties or permissions.
Windows: Show extensions before you rename
Windows hides file extensions by default, so you may not see them when you look at your files. To show them, open File Explorer, click the View tab at the top, and check the box next to File name extensions. Now you will see the full filename including the extension.
Once extensions are visible, right-click the file you want to rename and select Rename. The entire filename will highlight. Edit only the letters after the period — for example, change photo.jpg to photo.png. Press Enter when you are done. If a dialog box asks whether you want to change the extension, click Yes.
If you cannot see the extension even after checking the box, the file may be locked by its program. Close any program that might be using the file and try again. System files and some protected documents cannot be renamed this way.
Mac: Use the rename dialog
On Mac, file extensions are usually hidden in the Finder, but you can still rename them. Click the file once to select it, then press Return (or Enter on some keyboards). The filename will become editable in a text box. Edit the extension at the end of the name — for example, change document.txt to document.rtf.
When you press Return again, a dialog box will appear asking whether you want to keep the new extension or use the old one. Click Change to confirm the new extension. If the dialog does not appear, the file extension was already hidden and your change has taken effect.
Some files on Mac are locked to prevent accidental changes. If you cannot rename the file, right-click it, select Get Info, and look for a Locked checkbox near the bottom. Uncheck it and try renaming again.
Linux: Use the mv command in terminal
On Linux, open a terminal window. Navigate to the folder containing the file using the cd command — for example, cd Downloads takes you to your Downloads folder. Then type the mv command followed by the current filename and the new filename with the new extension.
The command looks like this: mv oldfile.txt newfile.pdf. Replace oldfile.txt with your actual filename and newfile.pdf with the new name and extension you want. Press Enter to execute the command. The file will be renamed immediately.
If you get a "permission denied" error, the file may be owned by another user or protected. You can try adding sudo at the start of the command — sudo mv oldfile.txt newfile.pdf — but this requires administrator access and should only be used for files you own.
When changing the extension does not work
Changing a file extension only tells your computer which program to use when opening the file. It does not change what is actually inside the file. If you rename a .jpg image to .txt, your computer will try to open it as a text file, but the image data is still there — the file will just look like gibberish.
To actually convert a file from one format to another, you need software designed for that conversion. For images, use Paint (Windows), Preview (Mac), or GIMP (free, all platforms). For documents, use Microsoft Word, Google Docs, or LibreOffice. These programs can open a file in one format and save it in another.
Some file types are not convertible. A video file cannot become an audio file just by changing the extension. You would need video editing software to extract the audio and save it separately.
Why programs sometimes prevent extension changes
Some programs lock their files to prevent you from accidentally breaking them. Microsoft Word documents, for example, may resist renaming because Word wants to keep them as .docx files. If you cannot rename a file, the program that created it may be running in the background.
Close all programs that might be using the file, then try renaming again. On Windows, you can also check the Details tab in the file's properties to see which program is associated with it. On Mac, right-click the file, select Get Info, and look under Open with to see which program claims ownership.
If a file is truly locked by the system, you may need administrator access to change it. On Windows, right-click the file, select Properties, click the Security tab, and check whether your user account has permission to modify the file. On Mac, use Get Info and adjust the Sharing & Permissions section at the bottom.
Common file extensions and what they mean
Image files: .jpg and .png are the most common. .jpg is smaller but loses some detail; .png keeps all detail but takes more space. .gif is for simple images and animations. .svg is for drawings that can scale to any size without losing quality.
Document files: .txt is plain text with no formatting. .docx is Microsoft Word. .pdf looks the same on any computer and cannot be easily edited. .rtf is rich text format, which preserves basic formatting but works across many programs.
Audio and video: .mp3 is compressed audio. .wav is uncompressed audio with better quality. .mp4 is the most common video format. .mov is Apple's video format. .avi is an older format still used for some videos.
Compressed files: .zip is the standard compressed folder format on all platforms. .rar is another compression format. .7z offers better compression but is less common.
Frequently Asked Questions
Will changing the extension damage my file?
Changing the extension alone will not damage the file. The data inside stays the same. However, if you change the extension to something your computer does not recognize, you may not be able to open it easily. You can always change it back.
Can I change multiple file extensions at once?
On Windows and Mac, you can select multiple files at once and rename them together, but you will rename all of them to the same name, which is usually not what you want. For batch renaming with different extensions, use a dedicated tool like Bulk Rename Utility (Windows) or A-Zippr (Mac). On Linux, you can use a loop in the terminal: for f in *.txt; do mv "$f" "${f%.txt}.pdf"; done changes all .txt files to .pdf.
What if I do not see a file extension at all?
On Windows, go to View in File Explorer and check File name extensions. On Mac, select the file, press Return, and the extension will appear in the rename box even if it is normally hidden. On Linux, extensions are always visible in the terminal.
Can I change a file extension to make it open in a different program?
Yes, but only if the other program can actually read that file format. Changing a .txt file to .pdf will not make it a real PDF — it will just confuse your computer. To open a text file in a PDF reader, you need to actually convert it using software like LibreOffice or an online converter.
Why does my file extension keep changing back?
Some programs automatically change the extension when you save a file. If you save a document in Microsoft Word, it will change the extension back to .docx even if you renamed it to something else. To prevent this, save the file in a different format using File > Save As and choose the format you want.