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, your computer adds a period followed by a few letters to the end of the filename. That code — like .docx, .jpg, or .mp4 — is the file extension. It is the instruction manual your computer reads to know which program should open the file and how to read the data inside.
Without the extension, your computer would have no way to know whether a file named "vacation" contains a photo, a video, or a text document. The extension is not decoration or optional. It is the core piece of information that makes the file usable.
Key Takeaways
- A file extension is the letters after the period at the end of a filename, such as .pdf, .xlsx, or .png.
- The extension tells your computer which program to use to open the file and how to interpret the data inside.
- Different file types have different extensions: documents use .docx or .pdf, images use .jpg or .png, and videos use .mp4 or .mov.
- Changing or removing a file 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.
How file extensions work
When you double-click a file, your computer looks at the extension first. It then checks a list of programs installed on your system to find one that knows how to read that file type. If you have Microsoft Word installed and you double-click a .docx file, Windows or Mac will automatically open Word and load the document inside.
The extension is a label, not a container. Changing a file named photo.jpg to photo.png does not turn the photo into a PNG file — it just tells your computer to try opening it with a PNG reader, which will likely fail or show garbage. The actual data inside the file has not changed.
Some programs can read multiple file types. Adobe Photoshop, for example, can open .jpg, .png, .gif, and many others. When you open a file manually through the program's menu instead of double-clicking it, the extension matters less because you are telling the program directly what to do.
Common file extensions and what they mean
Different kinds of files use different extensions. Here are the ones you will encounter most often:
| File Type | Common Extensions | What It Is |
|---|---|---|
| Documents | .docx, .doc, .pdf, .txt | Text files, usually created in Word or a text editor. .pdf files are read-only and look the same on any device. |
| Spreadsheets | .xlsx, .xls, .csv | Data organized in rows and columns, usually created in Excel. .csv is plain text and opens in any spreadsheet program. |
| Images | .jpg, .png, .gif, .bmp | Pictures and graphics. .jpg is smaller but loses quality when saved. .png keeps quality and supports transparency. |
| Video | .mp4, .mov, .avi, .mkv | Moving images with sound. .mp4 is the most widely supported. .mov is Apple's format. |
| Audio | .mp3, .wav, .flac, .aac | Sound files. .mp3 is the most common. .wav and .flac preserve more detail but take up more space. |
| Compressed | .zip, .rar, .7z | Multiple files bundled and shrunk. You must extract them before using the files inside. |
| Web | .html, .css, .js | Code that makes websites work. .html is the page itself, .css controls how it looks, .js adds interactivity. |
Why extensions matter for security
File extensions can be used to hide what a file actually is. A malicious program might be named document.pdf.exe — it looks like a PDF to a quick glance, but the real extension is .exe, which means it is a Windows program that will run code on your computer when you open it.
This is why it is worth turning on the option to see file extensions on your computer. 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, and check "Show all filename extensions." Once you can see extensions, you will spot tricks like this immediately.
Be cautious of files with double extensions or extensions you do not recognize. If someone sends you a file and you are not sure what it is, ask them before opening it. A legitimate sender will not mind explaining what the file contains.
Why your computer hides extensions by default
Windows and Mac hide file extensions to make the desktop look cleaner and less technical. The idea is that you do not need to see .docx or .jpg — you can tell what a file is from its icon and name. For most everyday users, this works fine.
The downside is that hiding extensions makes it easier for malware to disguise itself. A program file can hide behind a familiar name. This is one reason security experts recommend turning extensions back on, especially if you download files from the internet regularly or receive attachments in email.
What happens when you change a file extension
Renaming a file from photo.jpg to photo.png does not convert the file. Your computer will try to open it with a PNG reader, but the data inside is still JPEG data. The program will either fail to open it or display corrupted garbage.
Some file conversions are possible, but they require actual conversion software, not just renaming. If you want to turn a JPEG photo into a PNG, you need to open it in an image editor like Paint, Photoshop, or free tools like GIMP, then save it as PNG. The program reads the original data and writes it in the new format.
The only time renaming an extension works is when a program supports multiple formats and you are just telling it which one you want. Even then, the file data itself does not change — you are only changing how the program interprets it.
How to find and change file extensions
To see a file's extension, look at the full filename. On Windows with extensions turned on, you will see something like "resume.docx" or "photo.jpg." On Mac, extensions are usually hidden in Finder but visible in the terminal or when you rename a file.
To rename a file and change its extension, right-click the file and select "Rename" on Windows or click the file once and press Enter on Mac. Type the new name including the period and extension. Your computer will warn you if you are changing the extension — it is usually safe to proceed, but remember that changing the extension does not change what the file actually is.
If you want to change a file's actual format, use the program that created it or a conversion tool. Open the file in the original program, go to File > Save As, and choose a different file type from the dropdown menu. The program will convert the data and save it with the new extension.
Frequently Asked Questions
Can I remove the file extension entirely?
Technically yes, but your computer will not know how to open the file. On Windows, the system relies on the extension to match files to programs. On Mac, files have a hidden type code that works even without an extension, but it is still not recommended. Keep the extension so your computer can do its job.
What if a file has no extension?
Your computer will try to guess what the file is based on its internal structure, but this often fails. If you receive a file with no extension and you know what type it should be, you can add the extension yourself by renaming the file. For example, if someone sends you a photo without an extension, you can rename it to photo.jpg.
Why do some files have multiple extensions like .tar.gz?
Some file formats are built from other formats. .tar.gz means the file was first compressed with gzip (creating a .gz file) and then bundled with tar (a tool that groups files together). You must extract it in the right order — usually one tool handles both steps automatically. Do not remove either extension.
Is it safe to change a file extension?
Changing the extension is safe as long as you understand it does not change the file itself. If you rename a photo from .jpg to .png, the photo data stays the same — only your computer's attempt to open it changes. If the program cannot read the data, it will simply fail to open. You can always rename it back.
What does it mean when a file has an extension I do not recognize?
It means the file was created by a program you may not have installed. Search the internet for the extension to learn what program created it. If it is a file someone sent you and you do not recognize the extension, ask them what it is before opening it. Unknown extensions can sometimes indicate malware.