What a file extension is and why you might change it

A file extension is the two to four letters after the dot at the end of a filename — like .txt, .jpg, or .pdf. It tells your computer what program should open the file and how to read the data inside. You might need to change an extension if you're converting a file to a different format, fixing a file that lost its extension, or preparing a file for a specific program that expects a certain name format.

Changing the extension itself does not convert the file's contents. If you rename photo.jpg to photo.png, you have a file that claims to be a PNG but still contains JPG data — your computer may refuse to open it or display it incorrectly. To actually convert between formats, you need conversion software. Renaming the extension is useful only when the file's actual contents already match the new format, or when a program needs the correct label to recognize what it's looking at.

Key Takeaways

  • On Windows, right-click a file, select Rename, change the letters after the dot, and press Enter — you may see a warning asking you to confirm the change.
  • On Mac, select a file, press Return to enter rename mode, change the extension, and press Return again.
  • On Linux, use the mv command in the terminal: mv oldname.old newname.new — no confirmation needed.
  • Changing the extension does not convert the file's contents, so only rename if the file already contains the right type of data.
  • If you cannot see file extensions on your computer, you need to turn on the display setting first — extensions are hidden by default on Windows and Mac.

How to change an extension on Windows

Windows hides file extensions by default, so you may need to turn them on first. Open File Explorer, click the View tab at the top, and check the box next to "File name extensions." Once extensions are visible, find the file you want to rename, right-click it, and select Rename from the menu.

The filename will become editable with a text cursor. Change only the letters after the final dot — for example, change document.txt to document.docx or image.jpg to image.png. Do not change the filename itself unless you want to. Press Enter when you are done. Windows will ask you to confirm the change with a dialog box saying "Are you sure you want to change the file name extension?" Click Yes to proceed.

If you do not see the confirmation dialog, Windows may have already changed the extension silently. Check the file's properties to confirm: right-click the file, select Properties, and look at the "Type of file" line to see what your computer now thinks it is.

How to change an extension on Mac

Mac also hides extensions by default. Open Finder, click Finder in the menu bar, select Preferences, click the Advanced tab, and check the box next to "Show all filename extensions." Close the preferences window.

Find the file you want to rename in Finder and press Return (or Enter). The filename becomes editable. Change only the extension — the letters after the dot. Press Return again to confirm. Mac will show a dialog asking "Are you sure you want to change the extension from .old to .new?" Click Change to proceed. If you click Keep, the change will not happen.

If you want to hide extensions again after you are done, return to Finder Preferences and uncheck the "Show all filename extensions" box.

How to change an extension on Linux

Linux shows file extensions by default in most file managers. If you prefer to use the graphical interface, open your file manager, right-click the file, and look for a Rename option. Change the extension and press Enter.

From the terminal, use the mv command, which stands for "move" but also renames files. Type mv oldfilename.old newfilename.new and press Enter. For example, mv report.txt report.pdf changes report.txt to report.pdf. Linux does not ask for confirmation — the change happens immediately. If you make a mistake, you can undo it by running mv again with the names reversed.

When changing an extension will not work

Renaming the extension only works if the file's actual contents already match the new format. If you have a Word document saved as a .txt file and you rename it to .docx, Word may open it but will likely show garbled text or an error because the file does not actually contain Word formatting — it contains plain text.

To convert a file from one format to another, you need the right software. For images, use a tool like GIMP, Photoshop, or an online converter. For documents, use the original program's "Save As" or "Export" feature and choose the new format from the dropdown menu. For audio and video, use a dedicated converter like Handbrake or FFmpeg. These tools read the original file and write out a new file with the correct internal structure for the new format.

Fixing files that lost their extension

If a file has no extension at all, your computer may not know which program should open it. You can add an extension by renaming the file and typing the dot and letters at the end. For example, if you have a file called "document" and you know it is actually a Word file, rename it to "document.docx."

If you are not sure what format the file is in, try opening it with a text editor first. Right-click the file, select "Open with," and choose Notepad (Windows) or TextEdit (Mac). If you see readable text or recognizable code, it is likely a text-based format like .txt or .csv. If you see random characters or symbols, it is a binary format like an image or video, and a text editor will not help. In that case, you may need to look at the file's properties or ask whoever gave you the file what format it is.

Common file extensions and what they mean

Here are some extensions you will encounter often and what they represent:

ExtensionFile TypeCommon Programs
.txtPlain textNotepad, TextEdit, any text editor
.docxWord documentMicrosoft Word, Google Docs
.pdfPortable documentAdobe Reader, web browsers
.jpg, .pngImagePhoto viewers, web browsers, image editors
.mp3, .wavAudioMedia players, audio editors
.mp4, .movVideoMedia players, video editors
.zipCompressed archiveArchive manager, built-in tools
.csvSpreadsheet dataExcel, Google Sheets, text editors

Frequently Asked Questions

Will changing the extension break the file?

Changing the extension alone does not damage the file's contents. Your computer may refuse to open it or display it incorrectly if the extension no longer matches what is actually inside, but the data itself remains unchanged. You can always rename it back to the original extension.

Can I change multiple files at once?

Most file managers do not have a built-in batch rename feature for extensions. On Windows, you can select multiple files, right-click, and rename them one at a time. On Mac and Linux, the terminal offers more power — tools like rename (Linux) or brew install rename (Mac) let you change many extensions at once with a single command, but they require terminal knowledge.

What if I cannot see the extension even after turning it on?

Some files, especially system files, may have hidden extensions that do not appear even when the setting is on. On Windows, check the file's properties by right-clicking and selecting Properties — the file type will be listed there. On Mac, select the file and press Command+I to open the Info window.

Is it safe to change a file extension?

It is safe to rename the extension as long as you keep a backup of the original file first. If the new extension does not match the file's contents, you can simply rename it back. Never change the extension of system files or program files unless you know exactly what you are doing.

How do I know what extension a file should have?

If you created the file yourself, you should know what program made it — that program's default format is usually the right extension. If someone sent you the file, ask them what format it is. If you have an old file with no extension, try opening it with a text editor or checking its properties to see if your computer can guess the type.