A file extension is the short code at the end of a filename that tells your computer what kind of file it is and which program should open it
When you save a document, photo, or video, the filename ends with a dot followed by letters — like .docx, .jpg, or .mp4. That suffix is the extension. It is not decoration. Your operating system reads it to decide which program to use when you double-click the file. A file named resume.docx opens in Word or a compatible editor. The same content named resume.txt opens in Notepad. The extension is the instruction.
Extensions matter because they are how your computer sorts files into categories and prevents you from accidentally opening a photo in a text editor or a spreadsheet in a video player. They also matter for security: a file that looks like a photo but has a .exe extension (executable) is actually a program, and running it could install malware. Learning to spot extensions helps you avoid that trap.
Key Takeaways
- File extensions are the letters after the dot at the end of a filename, and they tell your computer what type of file it is.
- Windows hides extensions by default, but you can turn on the option to see them in File Explorer settings.
- A file can have the wrong extension attached to it, so seeing the extension helps you catch disguised files before you open them.
- Common extensions include .docx for Word documents, .jpg for photos, .pdf for portable documents, and .exe for programs.
- Changing an extension does not change what the file actually is — renaming a photo from .jpg to .txt does not turn it into text.
Why Windows hides extensions by default
Microsoft chose to hide extensions in Windows to make the interface look cleaner for everyday users. Instead of seeing Budget 2024.xlsx, you see just Budget 2024, with an icon that shows it is a spreadsheet. For most people most of the time, this works fine — the icon is enough.
The problem is that hiding extensions makes it easier for someone to trick you. A malicious file named Invoice.pdf.exe will display as just Invoice.pdf with a PDF icon, even though it is actually an executable program. When you double-click it, you run the program, not open a document. Turning extensions on is one of the simplest ways to catch this kind of deception.
How to show file extensions in Windows
Open File Explorer (the folder icon on your taskbar). At the top, click the View tab. Look for a checkbox labeled File name extensions and click it. From that moment on, every file will show its full name including the extension.
On a Mac, open Finder, click Finder in the menu bar, then Settings. Go to the Advanced tab and check the box that says Show all filename extensions. The change takes effect immediately.
Common file extensions and what they mean
You will encounter the same extensions repeatedly. Knowing what they are helps you understand what you are opening and whether it is safe to run.
| Extension | File Type | What It Does |
|---|---|---|
| .docx | Word document | Text document created in Microsoft Word or compatible software |
| .xlsx | Excel spreadsheet | Spreadsheet with cells, formulas, and data |
| Portable document | Document that looks the same on any device; cannot be edited without special tools | |
| .jpg or .jpeg | Image | Photograph or compressed image file |
| .png | Image | Image file that supports transparency; often used for graphics |
| .mp4 | Video | Video file that plays on most devices and media players |
| .mp3 | Audio | Compressed audio file for music or voice |
| .exe | Executable program | A program that runs on Windows; only open if you trust the source |
| .zip | Compressed archive | Folder containing multiple files squeezed into one; must be unzipped to use |
| .txt | Plain text | Text with no formatting; opens in any text editor |
Why changing an extension does not change the file
Renaming a file from photo.jpg to photo.txt does not turn the photo into text. The file itself — the actual data inside — stays exactly the same. All you have done is changed the label your computer reads. When you try to open it, your computer will be confused because the label says "text" but the data is actually image information.
This is why you cannot fix a corrupted file by changing its extension. If a video file is damaged, renaming it from .mp4 to .avi will not repair it. It will only make your computer try to play broken video data using the wrong player, which usually results in an error message.
How to spot disguised or dangerous files
Once you turn on extensions, watch for files that have two extensions or an extension that does not match the icon. A file named Document.pdf.exe is a program pretending to be a PDF. A file with a PDF icon but an .exe extension is also a program, not a document. Do not open either one unless you are certain you downloaded it from a trusted source and were expecting to receive it.
Be especially cautious with files that end in .exe, .bat, .cmd, .com, .msi, or .scr — these are all executable files that run programs on your computer. If you receive one by email or download from an unfamiliar website, assume it is dangerous unless you have a specific reason to trust it. Even files that look like documents can contain hidden code, so if something feels off, do not open it.
What to do if you cannot open a file
If you double-click a file and nothing happens, or you get an error message, the most common reason is that you do not have the right program installed. A .docx file needs Word or a compatible editor. A .mp4 video needs a media player. Check the extension to understand what program you need.
If you have the right program but it still will not open, the file may be corrupted or the extension may be wrong. Try right-clicking the file, selecting Open with, and choosing a different program from the list. If that does not work, the file itself may be damaged and cannot be recovered.
Frequently Asked Questions
Can I change a file extension to open it in a different program?
Changing the extension will not convert the file — it will only change the label. Your computer will try to open it with the new program, but if the data inside does not match, you will get an error. The only way to truly convert a file is to use software designed for that conversion, like an image editor or document converter.
Why do some files have multiple extensions?
A file like archive.tar.gz has two extensions because it is compressed twice — first with tar, then with gzip. You must unzip it in the correct order to access the contents. Double extensions are normal for some file types, but they are also used by scammers to hide dangerous files, so pay attention to what you are opening.
Is it safe to change a file extension?
Changing an extension is safe if you understand what you are doing. Renaming photo.jpg to photo.txt will not harm your computer — it will just confuse your operating system. However, never change an extension on a file you do not recognize or trust, because you might accidentally make a dangerous file easier to run.
What does it mean if a file has no extension?
Files without extensions are common on Mac and Linux systems. Your computer identifies them by reading the data inside rather than the filename. On Windows, a file with no extension will not open automatically — you have to right-click it and choose which program to use.
Can a file have the wrong extension on purpose?
Yes. Malware creators often disguise executable files with document extensions to trick you into running them. This is why seeing the full filename with extensions turned on is important — it helps you spot when a file's extension does not match what you expected to receive.