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 suffix is the file extension. It is not decoration. Your computer reads it to decide which program should open the file, how to display it, and what the file can do. Without it, your computer would have no way to know whether "resume" is a Word document, a PDF, or a video file.
The extension is separate from the filename itself. You can name a file anything you want — "my budget", "vacation photos", "tax return" — and the extension stays at the end to identify the file type. Most of the time, your operating system hides extensions from view, which is why many people never notice them. But they are always there, working behind the scenes.
Key Takeaways
- A file extension is the letters after the final dot in a filename, and it identifies what kind of file it is to your computer.
- Common extensions include .docx for Word documents, .pdf for PDFs, .jpg for photos, and .mp4 for videos.
- Your operating system uses the extension to decide which program opens the file when you double-click it.
- You can turn on the display of extensions in your settings if you want to see them, which is useful when troubleshooting file problems.
- Changing or removing an extension does not change what the file actually is — it only confuses your computer about how to open it.
How extensions tell your computer what to do
When you double-click a file, your computer does not read the entire file to figure out what it is. Instead, it looks at the extension first. The extension is a shorthand label that says "this is a Word document" or "this is a photo" or "this is a spreadsheet." Your computer then checks its settings to see which program is assigned to that extension and opens the file in that program automatically.
This is why changing a file's extension can break it. If you rename "photo.jpg" to "photo.docx", your computer will try to open it in Word, which does not know how to read image data. You will see an error or a blank screen. The file itself has not changed — it is still a photo — but your computer is now confused about what it is supposed to do with it.
Different operating systems use extensions in slightly different ways. Windows relies on extensions heavily. macOS and iOS also use extensions but sometimes hide them more aggressively. Android uses extensions too, though many Android apps also look at hidden data inside the file itself. But across all systems, the extension is the first thing your computer checks.
Common file extensions and what they mean
You have probably seen these extensions without thinking about them. .docx is a Microsoft Word document. .pdf is a portable document format — a file that looks the same on any computer. .xlsx is an Excel spreadsheet. .jpg and .png are image formats. .mp4 and .mov are video formats. .mp3 is audio. .zip is a compressed folder that bundles multiple files together.
The extension tells you something about what the file contains, but it does not tell you everything. A .txt file is plain text — just letters and numbers, no formatting. A .docx file can contain text, images, tables, and formatting. A .jpg file is a compressed photo. A .png file is also an image but uses a different compression method and can have a transparent background.
Some extensions are more common than others. .html is a web page. .exe is a Windows program. .app is a Mac program. .apk is an Android app. .rar and .7z are other compression formats. You do not need to memorize these, but knowing a few common ones helps you understand what a file is when you see it.
Why your computer hides extensions by default
Most operating systems hide file extensions in the normal file view. Windows does this, macOS does this, and so do phones. The reason is straightforward: extensions can be confusing for people who do not think about file types. A filename like "resume.docx" looks cleaner as just "resume" to most users.
But hiding extensions also creates a security risk. A malicious file could be named "document.pdf.exe" — it looks like a PDF, but the real extension is .exe, which means it is a program. If extensions are hidden, you would see only "document.pdf" and might open it thinking it is safe. This is why security experts recommend turning on the display of extensions, especially if you read files from the internet or receive email attachments.
You can turn extensions on in your settings. On Windows, open File Explorer, click View, and check the box for "File name extensions." On a Mac, open Finder, click Finder in the menu bar, select Preferences, and check "Show all filename extensions." On phones, extensions are usually hidden and harder to show, but you can see them in file manager apps.
What happens when you change or remove an extension
Renaming a file and changing its extension does not actually change the file itself. If you rename "photo.jpg" to "photo.txt", the file is still a photo. Your computer will just try to open it with a text editor, which will show garbage characters instead of an image. The photo data is still there — you just told your computer to read it the wrong way.
Sometimes you need to change an extension on purpose. If you read a file and it has the wrong extension, or if you need to convert a file from one format to another, you might rename it. But renaming alone does not convert the file. To actually change a photo from JPG to PNG, you need to open it in an image editor and save it as PNG. The extension change is just the final step.
If a file is missing its extension entirely, your computer may not know how to open it. Some older systems or certain file types require the extension to be present. If you accidentally delete an extension, you can add it back by renaming the file and typing the dot and extension at the end.
How to see and change extensions safely
To see extensions on Windows, open File Explorer and go to the View tab at the top. Look for a checkbox labeled "File name extensions" and click it. From then on, you will see the full filename including the extension for every file in that folder and all subfolders.
On a Mac, open Finder and click Finder in the menu bar at the top left. Select Preferences, then click the Advanced tab. Check the box that says "Show all filename extensions." This applies to all folders on your Mac.
To change an extension, right-click the file and select Rename (Windows) or press Enter while the file is selected (Mac). Type the new name and extension, then press Enter. Your computer will ask you to confirm that you want to change the extension. Click Yes or Confirm. Be careful when doing this — only change extensions if you understand what you are doing, because it can prevent the file from opening correctly.
File extensions across different devices and programs
The same file extension means the same thing across Windows, Mac, and Linux. A .docx file is a Word document on any system. A .jpg is a photo on any system. But different programs might be assigned to open the same extension. On one computer, .pdf files might open in Adobe Reader. On another, they might open in a web browser. The extension is the same; the program that opens it is different.
You can change which program opens a file type. Right-click a file, select "Open with" (Windows) or "Open with" (Mac), and choose a different program from the list. You can also set a default program for that extension so it always opens in your chosen program. This is useful if you prefer one PDF reader over another, or if you want photos to open in a specific image editor.
On phones, extensions work differently because apps do not always rely on them. An Android phone might recognize a file as a photo based on data inside the file, not just the extension. But extensions still matter — if you email a file to someone, the extension helps their computer understand what it is.
Frequently Asked Questions
Can I change a file extension to make it a different file type?
Changing the extension does not convert the file. It only tells your computer to try opening it with a different program. If you rename a photo to .txt, your computer will try to open it as text, but it will still be a photo file underneath. To actually convert a file, you need to open it in the correct program and save it in the new format.
What should I do if a file has no extension?
If a file is missing its extension, you can add one by renaming the file. Right-click it, select Rename, and type the extension at the end (for example, change "document" to "document.pdf"). Your computer will then know what program to use to open it. If you are not sure what extension it should have, look at similar files or ask where the file came from.
Is it dangerous to have extensions visible?
Showing extensions is actually safer, not more dangerous. It helps you spot suspicious files — like a file that claims to be a PDF but has a .exe extension. Hiding extensions makes it easier for malicious files to disguise themselves. Security experts recommend turning extensions on, especially if you read files or open email attachments.
Why do some files have multiple dots in the name?
A filename can have multiple dots, but only the last one matters. "my.resume.docx" has two dots, but .docx is the extension. Your computer reads only the part after the final dot. The dots in the middle are just part of the filename and do not affect how the file opens.
Can I use any extension I want when saving a file?
You can type any extension you want, but your computer will only recognize the file correctly if the extension matches the actual file type. If you save a Word document as .jpg, your computer will be confused. Most programs automatically add the correct extension when you save, so you usually do not have to think about it.