How to Change a File Extension (And What You Should Know Before You Do)
File extensions are those short suffixes after the dot in a filename — .jpg, .pdf, .mp4, .docx. They tell your operating system what kind of file it's dealing with and which program should open it. Changing one is surprisingly straightforward on most systems, but the results depend heavily on what you're actually trying to do and why.
What a File Extension Actually Does
The extension is essentially a label. When you double-click a file, your OS reads the extension and routes it to the appropriate application. Change .txt to .md and a text editor might display it with Markdown formatting previews. Change .jpg to .png and... you'll likely break the file, because the underlying data hasn't changed — only the label has.
This is the most important thing to understand: renaming an extension does not convert a file. It changes how the system identifies and attempts to open the file. Whether that works depends entirely on whether the new extension is compatible with the file's actual data format.
Some extension changes are harmless and genuinely useful. Others will corrupt or make a file unopenable. Knowing which scenario you're in matters.
How to Rename a File Extension on Windows
By default, Windows hides file extensions in File Explorer. You'll need to make them visible first.
To show extensions:
- Open File Explorer
- Click the View tab (Windows 10) or the View menu (Windows 11)
- Check File name extensions
To rename the extension:
- Right-click the file and select Rename
- Edit the text after the dot
- Press Enter
- Windows will warn you that changing the extension may make the file unusable — confirm if you're sure
You can also do this via Command Prompt using the ren command:
ren oldfilename.txt newfilename.md How to Rename a File Extension on macOS
macOS also hides extensions by default in Finder.
To show extensions:
- Open Finder → Settings (or Preferences) → Advanced
- Check Show all filename extensions
To rename:
- Click the file once to select it, then press Return (or right-click → Rename)
- Edit the extension directly
- Press Return — macOS will ask you to confirm the change
Via Terminal:
mv oldfilename.txt newfilename.md How to Change a File Extension on Linux 🐧
Linux doesn't enforce extensions the same way Windows and macOS do — it uses file signatures (magic bytes) internally — but extensions still matter for application compatibility.
In the terminal:
mv filename.txt filename.md Most graphical file managers (Nautilus, Dolphin, Thunar) also let you rename files and extensions directly through right-click menus.
When Changing an Extension Works vs. When It Doesn't
This is where things get nuanced.
| Scenario | Works? | Why |
|---|---|---|
.txt → .md | ✅ Yes | Both are plain text formats |
.htm → .html | ✅ Yes | Identical format, different convention |
.jpeg → .jpg | ✅ Yes | Same format, different naming |
.csv → .txt | ✅ Yes | CSV is plain text |
.jpg → .png | ❌ No | Different binary formats |
.mp4 → .mov | ❌ Usually not | Different container formats |
.docx → .zip | ✅ Interesting | DOCX is a ZIP archive — this actually works for exploration |
.exe → .txt | ❌ No | Binary data, not readable text |
The safe zone is moving between extensions that share the same underlying format. The risky zone is treating a rename as a conversion — it isn't.
When You Actually Need Conversion, Not Just Renaming
If your goal is to open a .jpg in a PNG-only application, or submit a .docx when only .pdf is accepted, you need a file format converter, not a rename.
Common approaches:
- Built-in OS tools: macOS Preview can export images in different formats. Windows Photos can save-as to other formats.
- "Save As" in your application: Most office suites, image editors, and video tools let you export to a different format through the Save As or Export menu.
- Online converters: Useful for one-off conversions without installing software, though not ideal for sensitive or private files.
- Dedicated software: Tools like HandBrake (video), GIMP or Photoshop (images), or LibreOffice (documents) give you control over conversion quality and settings.
The Variables That Affect Your Specific Situation
Your operating system determines the steps and whether extensions are visible by default. Windows, macOS, and Linux each handle this slightly differently.
Your goal matters most. Fixing a mislabeled file (e.g., a .txt that should be .csv) is different from trying to convert a video format.
Your technical comfort level changes the right approach. Command-line renaming is faster for batch changes; GUI renaming is safer for one-off tasks.
The file type determines the risk. Text-based formats are forgiving. Binary formats like images, audio, and video are not.
Batch renaming — changing extensions on dozens or hundreds of files — introduces additional tools and considerations. Utilities like PowerRename (Windows), Automator (macOS), or rename (Linux) handle this at scale.
Whether a simple rename is all you need, or whether you're dealing with a format compatibility problem in disguise, depends on looking closely at what the file actually contains — not just what it's currently labeled as. 📁