Hidden File Extensions: A Safety Guide
How hidden extensions and names like photo.jpg.exe trick people on Windows and macOS, how to show real extensions, and what to do if you opened a suspicious file.
Get the PDF
Free. No email or account needed. PDF · 144 KB
The preview only loads when you tap "Read PDF here", which saves mobile data. Download gives you the original PDF file.
Key takeaways
- Hiding an extension changes only how the name looks, not the file type.
- Read the last extension: photo.jpg.exe is a program.
- Do not judge a file by its icon.
- Turn on file name extensions on Windows and macOS.
- If you opened something suspicious, scan the computer and change passwords from a safe device.
Windows and macOS can hide the end of a filename, like .jpg or .exe. That is how a file called photo.jpg.exe can show up as photo.jpg. This guide shows how extension hiding works with a safe demo, how to spot a suspicious file, and which settings to turn on. It covers Windows and macOS.
First understand this: hiding an extension only changes how the filename looks in Finder or File Explorer. It does not turn the file into another format. Renaming or hiding part of a filename cannot turn a program into an image.
1. Safe demo: see how extension hiding works
Use only your own harmless test files. You do not need malware or a real program for this demo.
Windows 11
To hide extensions for the demo:
- Open File Explorer.
- Open the three-dot menu, then Options.
- Open the View tab.
- Check Hide extensions for known file types, then click OK.
To show them again (recommended):
- Open File Explorer.
- Select View > Show.
- Turn on File name extensions.
You should now see extensions such as .jpg, .pdf and .exe. On Windows 10 the wording and layout can differ. The setting to look for is Hide extensions for known file types, and Microsoft documents turning extensions on from File Explorer.
macOS
To hide the extension of one test file:
- Select your harmless file in Finder.
- Press Command-I (Get Info).
- Expand Name & Extension.
- Check Hide extension.
To show extensions for protection, open Finder > Settings > Advanced and turn on Show all filename extensions. This overrides the per-file "Hide extension" setting. For a single file, press Command-I, open Name & Extension and uncheck "Hide extension".
2. What is the double-extension trick?
A filename can have more than one dot. What matters is the file's real type and the last extension, which the operating system uses. The familiar-looking part in the middle does not count.
| Filename | What to notice |
|---|---|
| photo.jpg | Ends in .jpg, so it is an image |
| photo.jpg.exe | Looks like an image, but ends in .exe, which is a Windows program |
| invoice.pdf.exe | Looks like a PDF, but ends in .exe |
An .exe file is not automatically malware. Normal Windows software uses .exe too. The red flag is an executable you did not expect, especially one that pretends to be a photo or a document, or comes from a source you do not trust.
3. How to identify a suspicious file
- Show filename extensions. This removes one easy source of confusion.
- Read the ending carefully. A name like
photo.jpg.exeends in.exe. - Do not trust the icon alone. Icons can vary. Use the extension and the file information as clues.
- Check where it came from. Be careful with files that arrive unexpectedly by email, DM, cloud share or download.
- Pay attention to OS warnings. Do not click past a security prompt just to open an unknown file.
- When unsure, do not run it. Check with the sender, or scan the file with your normal security tools.
4. Quick protection settings
Windows
- File Explorer > View > Show > File name extensions = on.
- Keep Windows security warnings and protections switched on.
- Treat unexpected programs and script files with care.
macOS
- Finder > Settings > Advanced > Show all filename extensions = on.
- Keep macOS security warnings and protections switched on.
- Do not assume a familiar filename or icon proves a file is safe.
5. If you already opened something suspicious
Do not keep reopening it. Run your operating system's security scan, remove or quarantine anything it flags, and update your OS and security software.
If you typed a password after opening the file, or you think an account may be affected, change that password from a trusted device. Then review the active sessions and recent sign-ins on that account.
The one-line takeaway
Never decide a file is safe from its name or icon alone. Show extensions, check the real file type, and be careful with files you did not expect.
Sources: Microsoft Support: File Explorer in Windows and Apple Support: show or hide filename extensions on Mac.