A file extension is the short code at the end of a filename that tells your computer what kind of file it is and what program should open it

When you save a document, photo, or video, the filename ends with a dot followed by letters — like .pdf, .jpg, or .exe. That suffix is the extension. It is the file's ID card. Your computer reads it to decide whether to open the file in a word processor, image viewer, or web browser. Without it, your computer would have to guess.

Extensions matter for security because they tell you what a file actually is — or what someone claims it is. A file named "invoice.pdf.exe" looks like a PDF but is actually an executable program that could harm your device. Scammers rely on people not noticing the real extension hidden at the end. Learning to spot extensions is one of the simplest ways to avoid opening something dangerous by accident.

Key Takeaways

  • File extensions are the letters after the dot at the end of a filename, and they tell your computer what kind of file it is.
  • Common extensions include .pdf (documents), .jpg (photos), .xlsx (spreadsheets), and .exe (programs that run on Windows).
  • Scammers often hide dangerous file types by giving them names that look harmless, so always check the full filename before opening something from an unknown sender.
  • On Windows, extensions are often hidden by default, so you may need to turn on "Show file extensions" in folder settings to see them clearly.
  • If a file's extension does not match what you expected — like a photo that ends in .exe — do not open it.

How extensions work on your computer

When you double-click a file, your operating system looks at the extension and checks a list of programs it knows about. If the file is .docx, Windows or Mac knows to open it in Word or a compatible word processor. If it is .mp3, the computer opens it in a music player. The extension is the instruction that makes this happen automatically.

You can change an extension by renaming the file, but that does not change what the file actually is. Renaming a photo from vacation.jpg to vacation.pdf does not turn it into a PDF — it just confuses your computer about how to open it. The file's true nature stays the same.

Why extensions are hidden on Windows and Mac

By default, Windows and Mac hide extensions from view. Microsoft and Apple made this choice to make filenames look cleaner to everyday users. You see "Invoice" instead of "Invoice.pdf". The problem is that this also makes it easier for someone to trick you. A file could be named "Invoice.pdf.exe" but appear as "Invoice.pdf" because the .exe is hidden.

To see extensions on Windows, open File Explorer, click the View tab at the top, and check the box next to "File name extensions". On Mac, open Finder, go to Preferences, click the Advanced tab, and check "Show all filename extensions". Once you turn this on, you will see the real ending of every file. This is worth doing if you receive files from people you do not know well.

Common extensions and what they mean

Here are the file types you will encounter most often:

ExtensionFile TypeWhat It Is
.pdfPortable Document FormatA document that looks the same on any device; cannot be edited easily
.docxWord DocumentA document you can edit in Microsoft Word or similar programs
.xlsxExcel SpreadsheetA spreadsheet with rows, columns, and formulas
.jpg or .pngImage FileA photo or picture; .png supports transparency, .jpg does not
.mp3 or .wavAudio FileA sound file or music track
.mp4 or .movVideo FileA movie or video clip
.exeExecutable ProgramA program that runs on Windows; can be dangerous if from an unknown source
.zipCompressed FolderMultiple files bundled together and compressed to save space
.dmgMac Disk ImageA program installer for Mac computers

Why scammers use extensions to trick you

A common scam is to send you a file that looks like a document or photo but is actually a program. The file might be named "Resume.pdf.exe" or "Photo.jpg.exe". If extensions are hidden, you see only "Resume.pdf" or "Photo.jpg" and think it is safe to open. When you do, the .exe program runs instead, and it could install malware, steal passwords, or lock your files for ransom.

Another trick is to send you a .zip file that contains an .exe inside. You read what looks like a harmless archive, unzip it, and find an executable program. The .zip itself is not dangerous — it is just a container — but what is inside it might be. Always check what is in a .zip file before opening anything from it, especially if it came from someone you do not know.

How to stay safe with file extensions

Turn on "Show file extensions" in your operating system settings. This takes two minutes and gives you a clear view of what you are about to open. When you receive a file from someone, check that the extension matches what you expected. If a friend sends you a photo but the file ends in .exe, do not open it — ask them about it first.

Be especially cautious with files that have double extensions, like "document.pdf.exe" or "image.jpg.scr". These are almost always attempts to hide a program inside something that looks harmless. If you are unsure about a file, you can also right-click it and select "Properties" (Windows) or "Get Info" (Mac) to see more details about what it is before you open it.

Extensions on phones and tablets

iPhones, iPads, and Android devices also use extensions, but they hide them even more thoroughly than computers do. When you read a file on a phone, the operating system handles the extension automatically and usually opens the file in the right app without showing you the extension at all. This is convenient for everyday use, but it also means you have less control over what you are opening.

On Android, you can see extensions by opening a file manager app (like Files by Google) and looking at the file list. On iPhone, extensions are almost never visible to the user. If you are concerned about a file on your phone, the safest approach is to delete it if you do not recognize where it came from, or ask the person who sent it to confirm what it is.

Frequently Asked Questions

What if I change a file's extension — does that change what it is?

No. Changing the extension only changes the filename, not the file itself. If you rename a photo from "vacation.jpg" to "vacation.pdf", it is still a photo. Your computer will try to open it as a PDF and fail. The file's actual content stays the same no matter what you call it.

Can I get a virus just by downloading a file with a dangerous extension?

Downloading is usually safe. The danger comes when you open or run the file. A .exe file sitting in your Downloads folder cannot hurt you until you double-click it. If you read something suspicious, you can delete it without opening it and be fine.

Why do some files have multiple dots in the name?

A file like "report.final.docx" has dots in the name itself, not just at the end. Only the last extension (.docx) matters to your computer. The other dots are just part of the filename. Scammers use this to hide dangerous extensions — "invoice.pdf.exe" looks like a PDF because you see ".pdf" in the middle, but the real extension is .exe at the very end.

What should I do if I accidentally opened a suspicious file?

If you opened a .exe or other program file from an unknown source, run a full antivirus scan on your computer right away. Windows Defender (built into Windows) or a third-party antivirus like Malwarebytes can check for infections. If you are on Mac, run a scan with your antivirus software. If you are worried, you can also change your passwords from a different device while you wait for the scan to finish.

Do I need to worry about extensions on files I create myself?

No. Files you create in Word, Excel, or other programs automatically get the right extension when you save them. You do not need to add it yourself. The only time you should manually type an extension is if you are deliberately saving a file in a different format than the program normally uses.