Changing a file type in Windows 11 can mean renaming its extension, converting its contents into another format, or choosing a different app to open it. These actions solve different problems, and using the wrong one can leave a file that Windows no longer recognizes.
For example, renaming photo.jpg to photo.png changes only the name. It does not convert the JPEG image into PNG data. Use File Explorer only when the file already has the correct internal format and its extension is missing or incorrect. Use Save As or Export when the contents must be converted.
Choose the Correct Method First
| What you want | Correct method | Example |
|---|---|---|
| Correct or replace the extension | Rename in File Explorer | settings.txt to settings.ini |
| Create a genuinely different format | Save As, Export, or a converter | DOCX to PDF or JPG to PNG |
| Open the same file with another program | Change the default app | Open PDF files with Acrobat |
| Rename many matching extensions | Command Prompt or PowerShell | .txt to .bak in one folder |
Make a copy before experimenting with an important file. Avoid changing extensions on files inside Windows or Program Files, and never run a renamed script or executable unless you trust its source and understand its contents.
Show File Extensions in File Explorer
Windows may hide extensions for recognized file types. With extensions hidden, renaming report.docx may change only report while .docx remains attached invisibly.
- Press
Windows + Eto open File Explorer. - Select View on the toolbar.
- Point to Show.
- Enable File name extensions.
Microsoft confirms this path in its Windows file-extension documentation. Leaving extensions visible is useful when working with downloads, scripts, configuration files, or several files with similar names.
You can also open the three-dot File Explorer menu, select Options > View, clear Hide extensions for known file types, and apply the change.
Rename a File Extension
Use this method when the file contents are already compatible with the new extension or when you are restoring an extension that was removed accidentally.
- Locate the file in File Explorer.
- Select it and press
F2, or right-click it and select Rename. - Replace the letters after the final period.
- Press
Enter. - Select Yes when Windows warns that the file might become unusable.
Examples that can be valid in the right circumstances include:
settings.txt → settings.ini
script.txt → script.bat
page.txt → page.html
archive → archive.zipEach file must already contain data expected by the destination program. Adding .zip to an unknown file does not create an archive, and adding .bat to ordinary notes does not create a useful batch script.
Why Windows shows a warning
Windows warns you because applications use the extension to decide how to open the file. Changing photo.jpg to photo.zip makes archive software treat JPEG data as an archive, so the application will probably report that the file is invalid.
The warning does not normally erase the contents. When a renamed file stops opening, restore its original extension before trying anything else.
Convert the Actual File Format
Conversion requires software that understands the original format and can write the destination format. Use Save As, Save a copy, or Export whenever the source application supports the result you need.
Convert DOCX to PDF
- Open the document in Microsoft Word.
- Select File > Save As or File > Export.
- Choose PDF as the file type.
- Save the new copy.
Renaming .docx to .pdf does not create a PDF because the internal document structure remains unchanged.
Convert JPG to PNG with Paint
- Right-click the JPG file and select Open with > Paint.
- Select File > Save as > PNG picture.
- Choose a location and save the new file.
The PNG may be larger, and conversion cannot restore details already lost through JPEG compression.
Convert an Excel workbook to CSV
- Open the workbook and select the required worksheet.
- Select File > Save As.
- Choose CSV UTF-8 or the CSV type required by the destination system.
- Read Excel’s compatibility warning and save the file.
CSV cannot preserve multiple worksheets, charts, cell formatting, or formulas in their original workbook form. Keep the XLSX file when those features matter.
Use online converters cautiously
Avoid uploading confidential, financial, medical, business, or identity documents to an unknown conversion website. Prefer the application that created the file or a reputable local program. Keep the original until you have opened and checked the converted copy.
Change Which App Opens a File Type
The extension may already be correct while Windows opens it with the wrong application. Changing the default app does not rename or convert the file.
Change the app for one file type
- Right-click a file.
- Select Open with > Choose another app.
- Choose the preferred application.
- Enable Always use this app if Windows displays the option.
- Select OK.
Change defaults through Settings
- Press
Windows + I. - Open Apps > Default apps.
- Search for an extension such as
.pdf,.jpg, or.txt. - Select the current application.
- Choose the new default and confirm it.
Microsoft’s current default-app instructions explain that Windows can assign defaults by file type, link type, or application.
Rename Multiple Extensions With Command Prompt
Command Prompt can change matching extensions throughout the current folder. This is still a rename, not a conversion.
Create a test folder or backup first. Then open the target folder in File Explorer, select the address bar, type cmd, and press Enter.
Preview the matching files:
dir *.txtRename every .txt file in that folder to .bak:
ren *.txt *.bakRename one file by specifying both names:
ren "old report.txt" "old report.bak"Quotation marks protect names containing spaces. The command works immediately, so confirm the folder path and preview the matching files before running it.
Rename Multiple Extensions With PowerShell
PowerShell provides a safer preview option and more control over matching files.
Open the target folder, right-click an empty area, and select Open in Terminal. Confirm that the active profile is PowerShell.
List the intended files:
Get-ChildItem -File -Filter *.txtPreview the rename with -WhatIf:
Get-ChildItem -File -Filter *.txt |
Rename-Item -NewName { $_.BaseName + '.bak' } -WhatIfRead every proposed change. Remove -WhatIf only when the preview is correct:
Get-ChildItem -File -Filter *.txt |
Rename-Item -NewName { $_.BaseName + '.bak' }Adding -Recurse includes subfolders and can affect far more files than expected. Use it only with a tested command and a backup.
The PowerShell vs Command Prompt comparison explains why their commands and aliases can behave differently even inside the same Windows Terminal window.
Create BAT, PS1, HTML, or INI Files Correctly
Text-based formats can often be created with a text editor, but the contents must follow the syntax required by the destination program.
- Open Notepad or a code editor.
- Write valid content for the intended format.
- Select File > Save As.
- Change Save as type to All files.
- Enter the full name, such as
script.bat,task.ps1,page.html, orsettings.ini. - Choose the required encoding and save.
Do not trust a script because its extension looks familiar. BAT and PS1 files can download programs, delete data, change permissions, or alter Windows. Review the commands before running them.
When Windows blocks a trusted PowerShell script, use Running Scripts Is Disabled on This System to identify whether Process, CurrentUser, or organization policy is controlling it. Changing execution policy does not make an untrusted script safe.
File Extension Will Not Change
Work through the cause that matches what you see:
- The extension is hidden: Enable View > Show > File name extensions and edit the characters after the last period.
- The file is open: Close editors, media players, preview tools, and other applications using it.
- OneDrive is syncing: Wait for synchronization to finish and make sure the file is locally available before renaming it.
- You lack permission: Copy the file to Documents and test the copy. Do not take ownership of Windows system files merely to rename them.
- The new name already exists: Choose another name or move the conflicting file.
- The name contains invalid characters: Windows file names cannot contain
\ / : * ? " < > |. - File Explorer is unresponsive: Use how to restart File Explorer in Windows 11, then try again.
The Read-only attribute does not block every rename, but you can check it under Right-click > Properties when the file or its folder is controlled by another process.
Restore a File After Using the Wrong Extension
Rename the file again and restore the original extension. When you do not remember it:
- Check another copy, backup, attachment, or download record.
- Identify the application that created the file.
- Look at related files from the same source.
- Test only a copy, not the sole version of an important file.
- Restore the original from backup when the format cannot be identified safely.
Trying random extensions does not repair the file and can make its history harder to follow. The data may also be genuinely incomplete or damaged, especially when a download or cloud synchronization stopped early.
Why Showing Extensions Improves Security
Displaying extensions does not modify files. It can reveal misleading names such as:
invoice.pdf.exeWith known extensions hidden, that executable could appear to be a PDF. A familiar icon is not proof that a download is safe. Check the complete name, expected source, and digital signature where applicable, and scan unexpected files before opening them.
Frequently Asked Questions
Does changing a file extension convert the file?
No. Renaming changes the label at the end of the file name. Use Save As, Export, or suitable conversion software to rewrite the contents in another format.
How do I change TXT to BAT in Windows 11?
Confirm that the text contains valid batch commands, enable file name extensions, and rename .txt to .bat. You can also use Notepad’s Save As dialog, select All files, and enter a .bat name.
Can I change several file types at once?
Command Prompt and PowerShell can bulk-rename extensions. They cannot bulk-convert the underlying data. Real conversion requires a tool that can read the source format and write the destination format.
Why does the renamed file still open with the old program?
Both extensions may use the same default application, or the association may not have refreshed. Open Settings > Apps > Default apps, search for the new extension, and assign the correct program.
Can I remove an extension completely?
Windows allows extensionless file names, but most applications will not know how to open them automatically. Remove an extension only when a specific program or development workflow requires it.
Use File Explorer when the contents are already correct and only the extension needs changing. Use Save As or Export for a true format conversion, and use Default apps when the file type is correct but the opening program is wrong. Matching the method to the intended result prevents most unusable-file warnings and failed conversions.


