Changing a file extension means renaming the suffix that tells your computer what type of file it is

A file extension is the short code at the end of a filename — the .txt in "letter.txt" or the .jpg in "photo.jpg". Your computer uses this extension to decide which program opens the file. You can change it by renaming the file, but doing it wrong can make the file unreadable or break programs that depend on it. The safest approach depends on whether you are working on Windows, Mac, or Linux, and whether you want to change what the file actually is or just how it appears.

Key Takeaways

  • File extensions are the three or four letters after the final dot in a filename, and changing them does not change what the file actually contains — only what your computer thinks it contains.
  • On Windows, you must turn on "Show file extensions" in File Explorer settings before you can rename the extension itself.
  • On Mac, right-click the file, select "Get Info", and change the extension in the Name field, then confirm the warning that appears.
  • Changing a file extension can break the file if the contents do not match the new type — renaming a photo to .txt will not turn it into a text file.
  • If you need to actually convert a file from one format to another, you need conversion software, not just a rename.

How to change a file extension on Windows

Windows hides file extensions by default to keep the interface cleaner, 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 will see the full filename including the extension on every file.

Right-click the file you want to rename and select "Rename". The entire filename, including the extension, will become editable. Change only the letters after the final dot — for example, change "document.docx" to "document.txt". Press Enter to confirm. Windows will ask if you are sure you want to change the extension; click "Yes" to proceed.

If you do not see the "View" tab, you are probably in a folder view that does not show it. Click the three horizontal lines (menu icon) in the top left, then look for "Options" or "Settings" and find the "View" tab there instead.

How to change a file extension on Mac

Mac shows file extensions by default, so you can rename directly. Right-click or Control-click the file and select "Get Info" from the menu. Look for the "Name & Extension" section near the top of the window. Click in the name field and edit the extension — the part after the final dot.

When you press Enter or click outside the field, Mac will show a warning asking whether you want to keep the new extension. Click "Use the new extension" to confirm the change. If the warning does not appear, the file may be locked; close the Get Info window, right-click the file again, and look for an "Unlock" option.

How to change a file extension on Linux

Linux file managers vary, but most show extensions by default. Right-click the file and select "Rename" or "Rename File". Edit the extension — the part after the final dot — and press Enter to confirm. Some file managers will warn you that changing the extension may make the file unusable; click "Rename" or "Proceed" to continue.

If you prefer the command line, open a terminal and use the mv command: mv oldname.old newname.new. Replace "oldname.old" with your current filename and "newname.new" with the new name and extension you want. Press Enter to execute the command.

Why changing an extension alone does not convert a file

Renaming a file extension changes only the label, not the contents. If you rename a photo from "image.jpg" to "image.txt", your computer will try to open it as a text file, but the file still contains image data. The result is usually gibberish or an error message.

To actually convert a file from one format to another — for example, from JPG to PNG, or from DOCX to PDF — you need software designed for that conversion. Online converters, desktop programs like ImageMagick or LibreOffice, or the original application (like Photoshop or Microsoft Word) can do real conversion. Simply renaming the extension will not work.

When you might need to change a file extension

Common reasons to change an extension include fixing a file that was saved with the wrong one, preparing a file for a specific program that expects a certain extension, or working around a system that blocks certain file types. For example, some email systems block .exe files, so users sometimes rename them to .exe.txt and ask the recipient to rename them back.

Another reason is when you download a file and the extension gets corrupted or lost. If you download a photo but it arrives as "photo" with no extension, adding ".jpg" tells your computer to open it as an image.

What to do if a file stops working after you change the extension

If you renamed a file and now it will not open or your computer does not recognize it, you can undo the change by renaming it back to the original extension. Right-click the file, select "Rename", and change the extension back to what it was before. This restores the original label and usually fixes the problem.

If you cannot remember the original extension, look at the file's properties or details. On Windows, right-click the file and select "Properties"; the file type is usually listed there. On Mac, right-click and select "Get Info"; the kind of file is shown near the top. On Linux, use the file command in a terminal: file filename. This will tell you what type of file it actually is, even if the extension is wrong.

Frequently Asked Questions

Can I change a file extension to make it open in a different program?

Changing the extension tells your computer which program to use, but only if the file contents match. If you rename a Word document to .txt, it will open in Notepad, but the formatting will be lost or appear as code. The file itself has not changed — only the program that opens it.

What if I change an extension and Windows says the file might be unusable?

That warning means the file contents may not match the new extension. Click "Yes" or "Use the new extension" only if you are sure the file is actually that type. If you are unsure, click "No" and leave the extension as it was.

Can I remove the extension entirely?

Yes, you can rename a file to have no extension at all. However, your computer will not know what program to use to open it, and you may get an error. Most systems expect files to have extensions, so this is rarely useful.

Do I need special software to change a file extension?

No. Every operating system lets you rename files directly through the file manager. You only need special software if you want to actually convert the file to a different format, not just change the label.

Will changing a file extension affect the file size?

No. The extension is just a label in the filename. Changing it does not add or remove any data from the file itself, so the file size stays the same.