How to Change a File Extension on Windows, Mac, Linux, iPhone and Android
To change a file extension, first make extensions visible (on Windows 11: File Explorer > View > Show > File name extensions; on a Mac: Finder > Settings > Advanced > Show all filename extensions), then rename the file and edit the letters after the last dot, for example notes.txt to notes.md. Confirm the warning your system shows and you are done.
One thing to know before you start: changing the extension does not convert the file. It only changes which app your computer thinks should open it. Renaming report.docx to report.pdf does not make a PDF. This guide covers how to change extensions on every common platform, how to do many at once, and how to tell when a rename is enough and when you need a real converter.
Step 1: Make File Extensions Visible
Windows and macOS both hide extensions by default. If you rename a file while the extension is hidden and type .md at the end, you usually get notes.md.txt, with the real extension still there but invisible. Turn extensions on first.
Windows 11
- Open File Explorer.
- Click View in the toolbar.
- Hover over Show.
- Click File name extensions so it has a check mark.
Windows 10
- Open File Explorer.
- Click the View tab in the ribbon.
- Tick File name extensions in the Show/hide group.
macOS
- Click the desktop or open a Finder window so Finder is the active app.
- Choose Finder > Settings from the menu bar (called Preferences on older macOS versions).
- Open the Advanced tab.
- Tick Show all filename extensions.
The same Advanced tab has Show warning before changing an extension. Leave it on; the warning is a useful last check.
How to Change a File Extension on Windows
- Select the file in File Explorer.
- Press F2 (or right-click and choose the rename icon, or Show more options > Rename).
- Windows selects only the name, not the extension. Use the arrow keys or mouse to move to the part after the last dot and change it.
- Press Enter.
- Windows warns: "If you change a file name extension, the file might become unusable. Are you sure you want to change it?" Click Yes.
If you do not see a warning and the file now looks like notes.md.txt, extensions were hidden. Turn them on (Step 1) and fix the name. For more ways to rename on Windows, see how to change file names in Windows.
How to Change a File Extension on a Mac
Rename in Finder
- Select the file in Finder.
- Press Return. The name becomes editable.
- Change the text after the last dot.
- Press Return.
- Finder asks whether you want to keep the old extension or use the new one. Click Use .md (or whatever extension you typed). Clicking Keep .txt cancels the change.
Use Get Info
Get Info is handy when extensions are hidden for one particular file.
- Select the file and press Command-I (or right-click > Get Info).
- Expand Name & Extension.
- Edit the full name in the text field, including the extension.
- Untick Hide extension if it is ticked, so you can see the result in Finder.
- Close the window and confirm the extension change if asked.
The Hide extension checkbox is per file. That is why one file can show its extension while its neighbours do not, even with the global setting off.
Terminal
mv notes.txt notes.mdmv renames without asking, so double-check that notes.md does not already exist; if it does, it is overwritten. Add -i (mv -i) to be prompted first.
How to Change a File Extension on Linux
Linux does not hide extensions, and they matter less there: most desktop file managers look at the file contents as well as the name when choosing an app.
In a terminal:
mv notes.txt notes.mdIn GNOME Files (Nautilus), select the file, press F2, edit the extension and press Enter or click Rename. KDE Dolphin also uses F2. For more on renaming from the shell, including the rename utility, see how to rename files in Linux.
How to Change a File Extension on iPhone and iPad
You can only change extensions in the Files app; apps like Photos do not expose file names at all.
- Open Files and go to the folder holding the file.
- Tap the More button (the circle with three dots) at the top and choose View Options, then turn on Show All Extensions.
- Touch and hold the file and choose Rename.
- Edit the extension and tap Done.
Files on iCloud Drive, On My iPhone and most connected cloud providers can be renamed this way. Some third-party storage providers that plug into Files may restrict renaming, depending on the provider.
How to Change a File Extension on Android
Android file managers generally show the full name, extension included, in the rename box.
- Open your file manager (for example Files by Google, or My Files on Samsung phones).
- Find the file, touch and hold it, then tap the three-dot menu and choose Rename (on some file managers Rename is shown directly).
- Edit the extension and confirm.
Some file managers warn that the file might not open after changing the extension. That is the same warning as on a computer, and it means the same thing: the contents are unchanged. See renaming files on Android for more.
Changing Many File Extensions at Once
If you have a folder of .txt files that should be .md, do not rename them one at a time.
Command Prompt (Windows)
Open the folder, type cmd in the File Explorer address bar, press Enter, then run:
ren *.txt *.mdPowerShell (Windows)
Get-ChildItem *.txt -File | Rename-Item -NewName { $_.BaseName + '.md' }Add -WhatIf after the closing brace to preview the changes without renaming anything.
Terminal (Mac and Linux)
for f in *.txt; do mv -i -- "$f" "${f%.txt}.md"; done${f%.txt} strips the trailing .txt from each name before .md is added.
These are the short versions. The full walkthrough, including subfolders and the Bulk Rename Utility method, is in how to bulk rename file extensions. For Command Prompt specifically, including loops and numbering, see renaming multiple files with Command Prompt.
Renaming an Extension Does Not Convert the File
A file's format is decided by the bytes inside it. The extension is a label that tells the operating system which app to launch. When you change the label to match what is already inside, everything works. When you change the label to something the contents are not, the app that opens it will complain or show garbage.
When renaming the extension is enough
- .jpeg to .jpg (and back): the same JPEG format, two spellings.
- .htm to .html: the same HTML file.
- .tif to .tiff: the same TIFF format.
- .yml to .yaml: the same YAML text.
- .txt to .md: Markdown is plain text, so any text file is a valid (if plain) Markdown file.
- .txt to .csv: works if the text is already comma-separated values, one record per line.
- .txt to .html, .json, .py, .bat and other text formats: works when the text inside is already that kind of content. You are just telling the system which app should open it.
- .docx, .xlsx, .pptx to .zip: Office files are ZIP archives internally, so renaming one to .zip lets you open it and pull out embedded images. Rename it back afterwards.
- Wrong or missing extensions: if a download arrived as
photowith no extension, or asphoto.jfif, and it is really a JPEG, adding or fixing the extension is the correct fix.
When you need a real converter
- HEIC to JPG: HEIC is a different image format. On a Mac, open the image in Preview and use File > Export, then choose JPEG. On an iPhone you can set the camera to shoot JPG instead (Settings > Camera > Formats > Most Compatible).
- PNG to JPG, JPG to PNG, WEBP to JPG: different image formats. Export from an image editor (Preview on Mac, Paint on Windows via File > Save as).
- DOCX to PDF: use File > Save As or Export in Word, Pages or LibreOffice and choose PDF.
- PDF to DOCX: needs a converter; Word can open many PDFs and convert them, with mixed layout fidelity.
- MOV to MP4, MKV to MP4: these are different containers. A converter such as HandBrake, or remuxing with ffmpeg, does it properly.
- WAV to MP3, M4A to MP3: different audio encodings; use an audio converter.
- XLS to XLSX, DOC to DOCX: old and new Office formats are different; open in the Office app and save in the new format.
A common trap: some image viewers open a PNG that was renamed to .jpg because they read the file contents rather than trusting the extension. That makes it look like the rename worked. Upload forms, print shops and other software often check the actual format and reject the file. Convert properly when a specific format is required.
Fixing Double Extensions (photo.jpg.png, file.txt.txt)
Double extensions almost always come from hidden extensions. Someone typed .txt into a Save dialog or rename box while Windows or macOS was silently keeping .txt on the end, producing file.txt.txt. With extensions hidden, it displays as file.txt, which looks fine until you upload it somewhere.
To fix it:
- Turn on file extensions (Step 1 above) so you see the full name.
- Work out which extension is true. For
file.txt.txtit is obvious. Forphoto.jpg.png, the last extension is the one your computer uses, but the contents may be either format. On a Mac or Linux, runfile photo.jpg.pngin Terminal and it reports the real format. On Windows, open the file in an image editor and check the format shown in its properties or Save As dialog. - Rename the file so only the correct extension remains:
file.txt, orphoto.pngif the contents are PNG.
If you have a folder full of .txt.txt files, PowerShell fixes them in one go:
Get-ChildItem *.txt.txt -File | Rename-Item -NewName { $_.Name -replace '\.txt\.txt$', '.txt' }The Security Risk of Hidden Extensions
Hiding extensions makes one classic trick work. A malicious attachment named invoice.pdf.exe appears as invoice.pdf when extensions are hidden, because Windows hides the real extension, .exe. The icon may even be set to look like a PDF. Double-click it and you run a program.
Keeping extensions visible lets you see that the file is invoice.pdf.exe and leave it alone. As a rule, be suspicious of any attachment or download whose name ends in .exe, .scr, .bat, .cmd, .js, .vbs or .msi when you expected a document, and of any file with two extensions where the last one is executable.
Changing Names, Not Extensions
Most of the time people want to change the name in front of the extension, not the extension itself: IMG_4821.jpg to 2026-10-14-lisbon-tram.jpg, or scan0003.pdf to lease-agreement-2026.pdf. That kind of rename is always safe because the extension stays put. If you have hundreds of photos, scans or documents with meaningless names, File Renamer AI is a web app that reads the content of each file you upload, proposes descriptive names while keeping the original extension, lets you review them, and gives you the renamed files as a ZIP. For the general background, see our guide to file names versus file extensions.
Frequently Asked Questions
Does changing a file extension change the file type?
No. Changing the extension only changes the label your operating system uses to pick an app. The data inside stays in its original format. To actually change the type, for example HEIC to JPG or DOCX to PDF, open the file in an app that supports both formats and export or save it in the new format.
Why can't I see the file extension to change it?
Windows and macOS hide extensions by default. On Windows 11 turn them on in File Explorer under View > Show > File name extensions. On a Mac open Finder > Settings > Advanced and tick Show all filename extensions. On iPhone or iPad, open the Files app, tap the More button, choose View Options and turn on Show All Extensions.
Is it safe to change a file extension?
It is safe in the sense that nothing is deleted or altered; you can always rename it back. The file may simply fail to open if the new extension does not match its contents. Changing between equivalent extensions such as .jpeg and .jpg or .htm and .html is completely safe.
How do I change the extension of many files at once?
On Windows, open Command Prompt in the folder and run ren *.txt *.md, replacing the two extensions with yours. In PowerShell or on Mac and Linux, use a short loop that renames each file. Our bulk file extension guide walks through each method, including subfolders.
How do I fix a file named file.txt.txt?
Turn on file extensions so you can see the full name, then rename the file and delete the extra .txt. The double extension happened because the extension was hidden when someone typed it, so the system kept the real one and added it again.
Can I change a file extension on my phone?
Yes. On iPhone and iPad, use the Files app: turn on Show All Extensions in View Options, then touch and hold the file and choose Rename. On Android, use a file manager such as Files by Google, touch and hold the file and choose Rename. The same rule applies: the contents do not change.
Free tools
Related Posts
How to Rename a Bluetooth Device on iPhone, Mac, Android and Windows 11
How to rename a Bluetooth device on iPhone (Settings > Bluetooth > info > Name), Mac, Android and Windows 11, and why some car kits keep their name.
TutorialHow to Rename a File on Windows, Mac, Linux, iPhone and Android
How to rename a file on Windows, Mac, Linux, iPhone and Android: the rename shortcut for each, renaming folders and Word docs, and fixes for common errors.
TutorialHow to Rename AirPods on iPhone, Mac, Android and Windows
How to rename AirPods: connect them, then tap their name at the top of iPhone Settings. Plus Mac, Android and Windows steps, and why a reset undoes it.
Ready to organize your files?
Try AI renaming right away. No sign-up needed until you download.
Try It Free