How to Change a File Extension Safely
Changing the letters at the end of a filename—from .dat to .pdf, .zip to .docx, or .jpeg to .jpg—takes two seconds, yet half the time it solves an unopenable download immediately and the other half it produces a “file is damaged or unsupported” error.
The difference comes down to one rule: renaming a file extension only changes the label your operating system reads—it never converts a single byte inside the file.
Before renaming anything, drop the file into File Sniff’s free local file type checker to inspect its internal magic bytes and confirm what format the file actually is.
When changing a file extension works (and is completely safe)
Renaming is the right fix whenever the file’s internal bytes already match the target format, and only the filename label is wrong or missing:
- Mislabelled email or portal downloads: Corporate portals and older mail gateways regularly save a real PDF (
%PDF-) asdocument.datorattachmentwith no extension, or save a Word document (.docx) asreport.zipbecause.docxuses a PKZIP container. Once you confirm the real format, renaming.dat→.pdfor.zip→.docxlets Preview or Word open it cleanly. Read what a file extension mismatch means. - Equivalent extensions for the same format:
.jpgand.jpegare identical JPEG streams (FF D8 FF);.tifand.tiffare identical TIFF images;.htmand.htmlare both HTML documents;.txt,.csvand.tsvare plain text files where changing the suffix simply tells Finder or Explorer whether to open TextEdit or Excel by default. - Inspecting a copy of a ZIP-based container: Duplicating
presentation.pptxorbook.epuband renaming the copy to.ziplets you browse its internal XML and media assets safely without touching your original file.
When changing a file extension breaks things (convert instead)
If the bytes inside the file belong to a different format, changing the extension only tricks an app into opening bytes it cannot parse:
- HEIC or WebP renamed to
.jpg: iPhones shoot HEIC (ftypheic) and websites often serve WebP (RIFF…WEBP). Simply typing.jpgon the end ofIMG_4012.HEICleaves HEVC-compressed data inside a file labelled JPEG. Strict upload forms, older Windows apps and automated pipelines will reject it as corrupt. Use a real format converter instead: HEIC to JPG, WebP to JPG or PNG to JPG. See HEIC vs JPG for why the bytes differ. - Outlook
winmail.dator.msgrenamed to.pdf: Awinmail.datattachment (78 9F 3E 22) is a TNEF container holding attachments inside it—renaming it to.pdfwill never make Preview read it. Unpack it properly with Open winmail.dat or Open .msg & .eml emails. - Legacy
.docrenamed to.docx(or.xlsto.xlsx): Classic binary Office files use an OLE2 Compound Document container (D0 CF 11 E0…), whereas.docxis a ZIP archive of XML parts. Use Word or LibreOffice’s Save As command to convert between them.
How to show and change a file extension on each platform
By default, macOS and Windows hide known extensions, which causes a classic mistake: renaming invoice (whose hidden real name is invoice.dat) to invoice.pdf actually creates invoice.pdf.dat! Always reveal the full filename first.
On Mac (Finder)
- Select the file in Finder and press
Cmd + I(File → Get Info)—this is safer than inline renaming because the Name & Extension box always displays the true extension, even if Finder hides extensions globally. - Uncheck Hide extension if ticked, replace the suffix after the final dot, and press Return.
- Confirm the macOS prompt (“Are you sure you want to change the extension from…”).
- (Optional global setting) To always see extensions across Finder, open Finder → Settings → Advanced and tick Show all filename extensions.
If you fix mismatched extensions regularly on Mac, the native File Sniff app for Mac detects the true format from magic bytes and offers a one-click Fix Extension action with confirmation and full Cmd + Z Undo support.
On Windows 11 & Windows 10 (File Explorer)
- In File Explorer, open View → Show → File name extensions (Windows 11) or tick File name extensions on the View ribbon (Windows 10). Never rename extensions before enabling this toggle.
- Select the file, press
F2, edit the characters after the final dot, press Enter, and click Yes on the confirmation dialog.
On iPhone & iPad (Files app)
- Open the Files app, tap the
…(More) menu in the top-right corner → View Options, and enable Show All Extensions (iOS/iPadOS 16+). - Touch and hold the file, tap Rename, move the cursor past the dot to change the extension, tap Done, and confirm Use
.<ext>.
Security warning: disguised executables and double extensions
Attackers exploit hidden extensions using tricks like Remittance_Advice.pdf.exe, Scan_004.scr, Update.pkg or Unicode Right-to-Left Override characters. When File Explorer hides .exe, the victim sees only Remittance_Advice.pdf alongside a spoofed PDF icon.
Keep two safety habits whenever an attachment looks odd:
- Never rename an unknown attachment into
.exe,.msi,.bat,.cmd,.ps1,.vbs,.js,.app,.pkg,.dmgor.commandand run it. - Inspect before opening: Drop unfamiliar downloads into the free file type checker or hex viewer first. If a supposed PDF or invoice starts with
4D 5A(MZ, Windows executable) orCF FA ED FE(macOS Mach-O binary), delete it immediately and verify with the sender out-of-band. Read how to identify an unknown file safely for the complete checklist.
Inspect files natively
on Mac, iPhone & iPad.
File Sniff identifies files by their internal bytes, spots extension mismatches, reads metadata and scans folders locally on your device.