Renaming a file extension changes what program opens it

A file extension is the short code after the dot at the end of a filename — .txt, .jpg, .pdf, .docx. Renaming it tells your computer to treat the file as a different type. You can rename an extension in a few clicks on Windows or Mac, though the steps differ slightly between them.

The most common reason to rename an extension is when you save a file in the wrong format by accident, or when you need a program to open a file it normally wouldn't. For example, if you save a photo as .bmp but need it as .jpg, or if you export a document as .txt but want it to open in Word as .docx, renaming the extension fixes it without re-saving the whole file.

Renaming an extension does not change what the file actually contains — it only changes the label. If you rename a photo from .jpg to .txt, the file is still a photo, but your computer will try to open it as text, which usually shows gibberish. The file itself is not harmed, and you can rename it back.

Key Takeaways

  • On Windows, right-click the file, select Rename, change the text after the dot, and press Enter.
  • On Mac, click the file once to select it, press Return or Enter, change the extension, and confirm the warning that appears.
  • Renaming an extension only changes the label — the file contents stay the same, so renaming a photo to .txt will not turn it into text.
  • If a file has no visible extension, you may need to turn on "Show file extensions" in your system settings before you can rename it.
  • Renaming to the correct format for what the file contains (like .jpg for a photo) ensures the right program opens it automatically.

How to rename a file extension on Windows

On Windows 10 and 11, the simplest method is to right-click the file and select Rename from the menu. The entire filename, including the extension, becomes editable. Click at the end of the name, delete the old extension (the letters after the dot), type the new one, and press Enter.

For example, if the file is named photo.bmp, right-click it, select Rename, delete "bmp", type "jpg", so it reads photo.jpg, then press Enter. Windows will ask you to confirm the change. Click Yes.

If you do not see the extension at all — the file shows as just "photo" with no dot and letters — you need to turn on "Show file extensions" first. Open File Explorer, click the View tab at the top, and check the box next to "File name extensions". Now all your files will show their extensions, and you can rename them the same way.

How to rename a file extension on Mac

On Mac, click the file once to select it, then press Return or Enter. The filename becomes editable, and you can change the extension the same way as Windows — delete the old letters after the dot and type the new ones. Press Return again to save the change.

Mac will show a warning dialog asking whether you want to keep the new extension or use the old one. Click "Use [new extension]" to confirm. If you do not see the extension on your Mac, open Finder, click Finder in the menu bar at the top, select Preferences, click the Advanced tab, and check "Show all filename extensions".

On newer Macs running Monterey or later, you may also see a lock icon next to the extension. If the extension is locked, you cannot change it without unlocking it first. Click the lock, enter your password, and then you can rename the extension.

When renaming an extension actually works

Renaming an extension works best when you are converting between formats that store the same type of data. Renaming a photo from .bmp to .jpg tells your computer to treat it as a JPEG, and most image programs will open it correctly. Renaming a document from .txt to .docx tells Word to open it, and the text inside will display normally.

Renaming does not work if the file contents do not match the new extension. If you rename a Word document to .jpg, your computer will try to open it as a photo, and you will see only error messages or gibberish. The file is not broken — renaming it back to .docx will restore it — but the mismatch makes it unusable.

If you need to actually convert a file from one format to another (like turning a .bmp photo into a real .jpg file with smaller file size), renaming the extension is not enough. You need to open the file in the right program and save it in the new format. For photos, use an image editor like Paint or Preview. For documents, open the file in the program it belongs to and use File > Save As to choose a new format.

Why you might need to rename an extension

The most common reason is when you export or save a file and accidentally choose the wrong format. If you export a spreadsheet as .csv (comma-separated values) but your accounting software needs .xlsx (Excel format), renaming the extension tells your computer to open it in Excel instead of a text editor. The data inside is the same; only the label changes.

Another reason is when a program saves a file with an extension you do not recognize. Some older or specialized programs use uncommon extensions. If you know the file is actually a photo but it has a .tmp or .bak extension, renaming it to .jpg or .png lets you open it in a photo viewer.

You might also rename an extension to hide a file type temporarily. If you rename a .exe (executable program) to .txt, Windows will no longer try to run it as a program, which can be useful if you want to email it or store it safely without accidentally launching it. Renaming it back to .exe restores its original behavior.

What happens if you rename the wrong extension

If you rename a file to the wrong extension, the worst that happens is the file will not open, or it will open in the wrong program and show gibberish. The file itself is never damaged. straightforward rename it back to the correct extension, and it will work again.

If you are not sure what the correct extension should be, you can right-click the file (on Windows) or click it and press Space (on Mac) to see a preview or more information. This often tells you what type of file it is. You can also try opening it with different programs — right-click, select "Open with", and choose a program from the list. Once you find the program that opens it correctly, you know what extension it should have.

Frequently Asked Questions

Can renaming an extension break a file?

No. Renaming an extension only changes the label your computer sees. The file contents are untouched. If you rename a file to the wrong extension, it straightforward will not open or will open in the wrong program. Rename it back to the correct extension, and it works again.

What if I rename a file and it disappears?

It did not disappear — it is still there, but your computer may be hiding it. On Windows, open File Explorer and go to View > Show hidden files. On Mac, press Command+Shift+Period in Finder. You should see the file again. If you renamed it to an extension your system does not recognize, it might also be hidden by default.

Do I need to rename the extension if I just want to open a file in a different program?

Not always. You can right-click a file and select "Open with" (Windows) or right-click and choose "Open With" (Mac) to open it in any program you have installed, regardless of the extension. Renaming the extension is only necessary if you want that program to open the file automatically every time you double-click it.

Can I rename a file to have no extension at all?

Yes, but it is not recommended. Files without extensions confuse your computer about what program should open them. If you delete the extension entirely, the file will likely open in the wrong program or not open at all. Keep the extension so your system knows how to handle the file.

What if the extension is locked and I cannot change it?

On Mac, click the lock icon next to the extension, enter your password, and try again. On Windows, right-click the file, select Properties, uncheck "Read-only" at the bottom, click explore, and then try to rename it. If it is still locked, the file may be open in another program — close that program first and try again.