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 a few letters. That ending — like .docx, .jpg, or .mp4 — is the file extension. It is a label that your computer reads to understand what the file contains and what software can work with it. Without it, your computer would have no way to know whether a file is a spreadsheet, an image, or a video.
The extension is separate from the filename itself. If you save a photo as "vacation.jpg", the filename is "vacation" and the extension is ".jpg". Your computer uses the extension to decide what happens when you double-click the file — it will open the file in an image viewer if the extension is .jpg, but it would try to open it in a text editor if the extension were .txt, even if the actual file contents were identical.
Key Takeaways
- A file extension is the letters after the final dot in a filename, and it tells your computer what type of file it is.
- Common extensions include .docx for Word documents, .xlsx for spreadsheets, .jpg for photos, and .mp4 for videos.
- Changing or removing an extension does not change what the file actually is — it only confuses your computer about how to open it.
- On Windows, file extensions are often hidden by default, but you can turn on the option to see them in File Explorer settings.
- Different programs use different extensions for the same type of content, so a photo might be .jpg, .png, or .gif depending on how it was saved.
How your computer uses the extension to open files
When you double-click a file, your operating system (Windows, Mac, or Linux) reads the extension first. It then looks up what program is associated with that extension. If the extension is .docx, Windows knows to open it with Microsoft Word or another word processor. If it is .mp3, the computer opens it with a music player.
This system works because software developers agree on standard extensions. Microsoft Word always saves documents as .docx. Adobe Photoshop saves images as .psd. These agreements mean that files can move between computers and still open correctly, as long as the receiving computer has software that recognizes the extension.
If you rename a file and accidentally delete or change the extension, your computer will no longer know how to open it. Renaming "photo.jpg" to "photo.txt" does not turn the image into a text file — it just tells your computer to try opening an image file with a text editor, which will fail or show gibberish.
Common file extensions and what they mean
Different types of files have different extensions. Here are the ones you will encounter most often:
| Extension | File Type | Common Programs |
|---|---|---|
| .docx | Word document | Microsoft Word, Google Docs |
| .xlsx | Spreadsheet | Microsoft Excel, Google Sheets |
| Portable document | Adobe Reader, web browsers | |
| .jpg or .jpeg | Photo or image | Photos app, web browsers, image editors |
| .png | Image with transparency | Photos app, web browsers, image editors |
| .mp4 | Video | Windows Media Player, VLC, web browsers |
| .mp3 | Audio file | Windows Media Player, iTunes, Spotify |
| .zip | Compressed folder | Windows File Explorer, Mac Finder |
You do not need to memorize these. The important thing is understanding that the extension tells your computer what the file is. When you read a file from the internet or receive one in email, the extension is already there — you only need to know what it means if something goes wrong or if you are trying to open a file in a different program than usual.
Why extensions are hidden on Windows and how to show them
By default, Windows hides file extensions from view. You see "vacation" instead of "vacation.jpg". This was meant to make filenames look cleaner, but it actually makes it harder to understand what files are and can hide problems when extensions get changed accidentally.
To show extensions on Windows, open File Explorer and look for the View tab at the top. Click it, then look for a checkbox labeled "File name extensions" and turn it on. After that, you will see the full filename including the extension for every file on your computer. Mac and Linux show extensions by default.
Showing extensions is useful because it lets you spot when something is wrong. If you see a file named "resume.docx.txt", you know the extension got changed and the file may not open correctly in Word. If you see "photo.jpg.exe", that is a warning sign that the file might not be what it claims to be.
What happens when you change a file extension
Changing an extension does not convert a file from one type to another. It only changes the label your computer reads. If you rename "photo.jpg" to "photo.mp3", you have not turned a photo into a music file — you have just told your computer to try opening an image with a music player, which will fail.
Sometimes people try to change extensions to make a file work with different software. This almost never works. The only time changing an extension is correct is when you know the file was saved with the wrong extension by mistake. For example, if a Word document was somehow saved as .txt, you might change it back to .docx so it opens correctly.
If you need to convert a file from one format to another — like turning a .jpg into a .png — you need to use software designed for that conversion. You open the file in an image editor, then save it in the new format. The software does the actual conversion work; changing the extension yourself does not.
Why different programs use different extensions for the same content
You might notice that photos can be .jpg, .png, or .gif, and documents can be .docx, .odt, or .txt. This happens because different software companies developed their own formats, and each format has different strengths.
.jpg files are smaller and work well for photos with lots of colors. .png files are better when you need a transparent background. .gif files are for straightforward images or animations. All three are image files, but they store information differently, so they need different extensions to tell your computer which format they are in.
The same is true for documents. .docx is Microsoft's format and includes formatting like bold text and colors. .odt is an open format that other programs can use. .txt is plain text with no formatting at all. When you save a document, the program chooses an extension based on what format it is using.
How to find the right extension when saving a file
When you save a file in most programs, a dialog box appears asking where to save it and what to name it. Near the bottom, there is usually a dropdown menu labeled "Save as type" or "File format". This menu shows you what extensions are available for that program.
If you are saving a Word document, the dropdown will show options like .docx, .pdf, and .txt. Choose the one you need. If you want to send the document to someone who does not have Word, you might choose .pdf instead. If you want to edit it in a different program later, you might choose .txt. The extension you pick determines what format the file will be saved in.
Most of the time, the default option is the right one. Word defaults to .docx, Photoshop defaults to .psd, and so on. You only need to change it if you have a specific reason to use a different format.
Frequently Asked Questions
Can I open a file with the wrong extension?
Not usually. If you try to open a .jpg file with Notepad, it will show garbage characters because Notepad expects text, not image data. However, some programs are flexible — web browsers can open many file types, and some image editors can read multiple formats even if the extension is wrong. The safest approach is to fix the extension first.
What if a file has no extension?
Your computer will not know what program to use to open it. You can usually fix this by right-clicking the file, choosing "Open with", and selecting the program you want. If you know what type of file it is, you can also rename it and add the correct extension yourself.
Is it dangerous to change a file extension?
Changing an extension will not damage the file itself, but it may prevent the file from opening. The real danger is if someone tricks you into changing an extension to hide what a file actually is — for example, renaming a .exe (executable program) file to .txt to make it look harmless. Never change an extension on a file from an unknown source.
Why do some files have two extensions, like .tar.gz?
Some files are processed by multiple programs in sequence. A .tar.gz file is first compressed with gzip (the .gz part) and then packaged with tar (the .tar part). You need to decompress it in the right order to get the original file. These double extensions are common with compressed files and backups, but you do not need to understand them — just use software designed to handle them.
Can I use any extension I want when saving a file?
Technically yes, but it will not work. If you save a Word document as "letter.xyz", your computer will not know how to open it because .xyz is not a recognized extension. Always use the extension that the program offers in the "Save as type" dropdown menu.