A file extension is the short code at the end of a filename that tells your computer what kind of file it is
When you save a document, photo, or video, the filename ends with a dot followed by a few letters — like .docx, .jpg, or .mp4. That's the file extension. It's not decoration. Your computer reads it to decide which program should open the file, and it tells you at a glance what you're looking at without having to open it first.
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". You can change the filename without changing what the file actually is, but changing the extension can break the file or make it unreadable.
Most operating systems hide file extensions by default, which is why you might not see them. But they're always there, working behind the scenes. Learning to see them and understand what they mean makes file management much easier.
Key Takeaways
- A file extension is the letters after the dot at the end of a filename, and it identifies what type of file it is to your computer.
- Common extensions include .docx for Word documents, .pdf for PDFs, .jpg for photos, and .mp4 for videos.
- Windows and Mac hide extensions by default, but you can turn on the setting to see them in your file manager.
- Changing a file's extension does not change what the file actually is — it only confuses your computer about which program should open it.
- Different programs save files in different formats, so the same document might be .docx, .odt, or .txt depending on which program created it.
How file extensions work
When you double-click a file, your computer looks at the extension first. It checks a list of rules it has stored that says "when you see .docx, open it with Microsoft Word" or "when you see .jpg, open it with the photo viewer". This matching system is called file association, and it's what makes files open in the right program automatically.
The extension is a promise about what's inside the file. A .pdf file contains a document formatted to look the same on any computer. A .xlsx file contains a spreadsheet with rows and columns. A .zip file contains other files compressed together to save space. Your computer trusts the extension and acts on it.
This is why renaming a file's extension can cause problems. If you have a Word document called "report.docx" and you rename it to "report.txt", you haven't actually changed what's inside — you've just lied to your computer about what it is. When you try to open it, your computer will try to open it as plain text, and it will look like garbage.
Common file extensions and what they mean
You'll see the same extensions over and over. Learning the most common ones helps you understand what you're working with:
- .docx — Microsoft Word document
- .xlsx — Microsoft Excel spreadsheet
- .pdf — Portable Document Format, readable on any computer
- .jpg or .jpeg — Compressed photo format
- .png — Photo format that supports transparency
- .gif — Animated image format
- .mp4 — Video file
- .mp3 — Audio file
- .zip — Compressed folder containing multiple files
- .txt — Plain text file with no formatting
When you download a file from the internet or receive one by email, the extension tells you what program you'll need to open it. If someone sends you a .pptx file, you know it's a PowerPoint presentation. If you see .mov, it's a video shot on an Apple device.
How to see file extensions on your computer
On Windows, open File Explorer and click the View tab at the top. Look for a checkbox labeled "File name extensions" and click it. From then on, you'll see the extension on every file in that window and most other windows.
On Mac, open Finder and go to the menu bar at the top. Click Finder, then Preferences. Click the Advanced tab and check the box that says "Show all filename extensions". Close the window and you'll see extensions on all your files.
Once you turn this on, you'll notice files you thought had no extension actually do. A file you thought was just called "photo" is actually "photo.jpg". This is the real name of the file — the extension was always there, just hidden.
Why different programs save the same thing differently
A document you write in Microsoft Word saves as .docx. The same document written in Google Docs can save as .docx, but it can also save as .odt (OpenDocument format) or .pdf. A plain text editor like Notepad saves everything as .txt. They're all documents, but they have different extensions because they're stored in different formats.
This matters when you share files. If you save a document as .docx and send it to someone using an older version of Word, they might not be able to open it. If you save as .pdf instead, almost anyone can open it, but they can't edit it. Choosing the right extension means choosing the right format for what you need to do with the file.
Some programs can open multiple formats. Microsoft Word can open .docx, .doc (the older format), .odt, and several others. But the program that created the file originally usually handles it best. A .jpg photo will open in dozens of programs, but it was created by a camera or photo editor.
What happens when you change a file extension
Renaming a file's extension doesn't change what the file actually is — it only changes what your computer thinks it is. If you rename "photo.jpg" to "photo.png", you haven't converted the photo to PNG format. You've just told your computer to treat it as a PNG. When you try to open it, your computer will be confused because the file's actual contents don't match the extension you gave it.
Sometimes this causes an error message. Sometimes the file opens but looks wrong. Sometimes your computer refuses to open it at all. The file itself is unchanged; only the label is wrong.
If you actually need to convert a file from one format to another — like turning a .jpg into a .png — you need to use the program that created it or a conversion tool. Simply renaming the extension is a shortcut that doesn't work.
File extensions and security
Malicious files sometimes hide behind fake extensions. A program file might be named "document.pdf.exe" — it looks like a PDF, but the real extension is .exe, which means it's an executable program. When you double-click it, you're running the program, not opening a document.
This is why seeing file extensions is a security habit. If you turn on the setting to show extensions, you'll spot tricks like this. A real PDF ends in .pdf, not .pdf.exe. A real photo ends in .jpg, not .jpg.exe.
Be especially careful with files you download or receive by email. If the extension doesn't match what you expected, don't open it. Ask the person who sent it whether they meant to send that file type.
Frequently Asked Questions
Can I change a file's extension to open it in a different program?
Changing the extension won't work — it will only confuse your computer. If you want to open a file in a different program, try right-clicking the file, selecting "Open with", and choosing the program you want. If that doesn't work, the file format might not be compatible with that program.
Why does my computer hide file extensions?
Operating systems hide extensions by default to make filenames look simpler to non-technical users. But this also makes it harder to spot problems and security risks. Turning on the setting to show extensions is a good habit for anyone managing their own files.
What if a file has no extension?
Files without extensions exist, but they're uncommon on Windows and Mac. Your computer won't know which program to use to open them. You can try right-clicking and selecting "Open with" to choose a program manually, or you can add an extension if you know what format the file is in.
Is it safe to rename a file's extension?
It's safe to rename the filename part (before the dot), but renaming the extension itself will break the file. Your computer won't be able to open it correctly. Only change the extension if you're intentionally trying to hide what type of file it is, which is rarely a good idea.
What's the difference between .jpg and .jpeg?
They're the same format — .jpg and .jpeg are just two different ways of writing the same extension. Your computer treats them identically. Either one works; .jpg is simply shorter and more common.