File extensions

Changing a file extension in Windows

Two different things get called this. One is renaming, which takes about four seconds once Windows stops hiding the extension from you. The other is converting, which renaming does not do and never has. Worth knowing which one you need before you start.

First, make extensions visible

Windows hides them by default, which is the real reason people cannot change one. What looks like report in Explorer is report.docx on disk, so renaming it edits the name and leaves the extension exactly where it was.

Windows 11
Open File Explorer, click the View menu in the toolbar, go to Show, and tick File name extensions. The change applies to every folder at once.
Windows 10
Open File Explorer, click the View tab in the ribbon, and tick the File name extensions checkbox on the right.
macOS
In Finder, open Settings, go to Advanced, and tick “Show all filename extensions”. Renaming then works the same way as on Windows.

Leaving them visible is worth doing for its own sake. Hidden extensions are how a file called invoice.pdf.exe shows up in your downloads folder looking like invoice.pdf, complete with a PDF icon the sender chose.

Renaming is not converting, and the difference is total

The extension is a label, not the format. Rename a .webp to .jpg and you still have a WebP file, byte for byte, now with a name that lies about it. Some programs will open it anyway because they check the contents; the ones that trust the extension will fail with an error that sounds like the file is damaged. If you need a different format, something has to read one and write the other.

When renaming is the right answer

  • A download or attachment arrived with .txt stuck on the end. The file underneath was never modified, so taking it off restores it.
  • A program saved with the wrong extension, or with none at all, and you know what it is.
  • Two extensions are the same format under different names, such as .jpeg and .jpg, or .htm and .html. Here renaming is genuinely harmless.

Changing a lot of files at once

PowerShell handles this in one line, in the folder you are standing in:

Get-ChildItem -Filter *.txt | Rename-Item -NewName { $_.Name -replace '\.txt$', '.md' }

Run it against a copy the first time. Renaming has no undo, and the $ in the pattern is doing real work: it anchors the match to the end of the name, so a file called notes.txt.backup is left alone.

Common questions

How do I change a file extension in Windows 11?
First make the extension visible: File Explorer, View menu, Show, File name extensions. Until you do that Windows shows you “report” rather than “report.docx”, so renaming only changes the part before the dot and the extension stays as it was. Once extensions are visible, press F2 on the file, edit the part after the dot, and confirm the warning Windows shows.
Does changing the extension convert the file?
No, and this is the part that matters. The extension is a label telling Windows which program to open the file with. Renaming a .webp to .jpg does not re-encode a single pixel: you get a WebP image with a misleading name, and any program strict about what it opens will reject it. Converting means running the file through something that reads one format and writes the other.
Why does Windows warn me the file might become unusable?
Because it might. If the new extension matches what the file actually is, nothing breaks. If it does not, you have told Windows to open it with the wrong program, and the failure that follows will look like a corrupt file rather than a renamed one. The warning is Windows admitting it cannot tell which of the two you are doing.
How do I remove a .txt that got added to a file name?
This one is a genuine fix rather than a conversion. Downloads and mail attachments sometimes arrive with .txt appended, giving you something like config.json.txt, and the file underneath is untouched. Show file name extensions, rename it back to config.json, and it works again. If you cannot see the .txt in the name, extensions are still hidden.
How do I change the extension of many files at once?
PowerShell does it in one line. Get-ChildItem -Filter *.txt | Rename-Item -NewName { $_.Name -replace '\.txt$', '.md' } renames every .txt in the current folder to .md. Run it in a copy of the folder the first time: rename operations have no undo, and the $ in the pattern matters because it anchors the match to the end of the name.
How do I find out what a file actually is?
Not from the extension, which anyone can change. The reliable signal is inside the file: most formats begin with a few fixed bytes, so a real PNG starts with PNG and a real ZIP with PK regardless of what it is called. Opening it in a hex editor shows that immediately. If you know the format but not the program, we have guides for the file types people get stuck on.

If you just need to open it

Renaming is rarely what someone actually wants. Our guides for the file types people get stuck on name the programs that read each one, and every program we point at is listed with its official download and SHA-256.