An extension is a short code at the end of a filename that tells your device what kind of file it is
When you save a document or read a photo, the filename ends with a dot followed by a few letters — like document.pdf or photo.jpg. That part after the dot is the extension. It is not decoration. Your device reads it to decide which program should open the file, and what the file actually contains inside.
Extensions matter because the same file could be opened as text, as an image, or as something else entirely, depending on which program reads it. The extension is your device's way of saying "this is a PDF, so use the PDF reader" or "this is a Word document, so use Microsoft Word." Without it, your device would have to guess, and it would guess wrong.
You do not usually type the extension yourself. When you save a file in Microsoft Word, Word adds .docx automatically. When you take a photo on your phone, the camera app adds .jpg or .heic automatically. But the extension is always there, even if your device hides it from view.
Key Takeaways
- An extension is the letters after the dot at the end of a filename, and it tells your device what program should open the file.
- Common extensions include .pdf for documents, .jpg for photos, .mp4 for videos, and .xlsx for spreadsheets.
- Your device usually adds the extension automatically when you save a file, so you do not need to type it yourself.
- If a file will not open, the extension may be wrong or the program that reads that file type may not be installed on your device.
- Changing an extension does not change what is actually inside the file — it only changes what your device tries to open it with.
Common extensions and what they mean
Different types of files have different extensions. A .pdf is a document that looks the same on any device. A .docx is a Word document that you can edit. A .jpg or .png is a photo or image. A .mp4 is a video. A .xlsx is a spreadsheet. A .txt is plain text with no formatting.
You will also see .zip files, which are folders that have been compressed to make them smaller and faster to read. When you open a zip file, your device unpacks it and shows you what is inside. On a Mac, you might see .dmg files, which are installers for programs. On Windows, you might see .exe files, which are also installers or programs you can run.
Email attachments often have extensions too. A .eml file is a saved email. A .msg file is an Outlook email. These extensions tell your device that the file is an email message, not a regular document.
Why your device hides extensions (and when to show them)
Most devices hide extensions by default because they make filenames look cluttered. Your computer shows you Vacation Photos instead of Vacation Photos.jpg. This is fine for everyday use — your device knows what program to use anyway.
But sometimes you need to see the extension. If a file will not open, you might need to check whether the extension is correct. If you are renaming a file, you might accidentally delete the extension and break it. If you read a file and it has the wrong extension, you will need to see it to fix it.
On Windows, open File Explorer, click the View tab at the top, and check the box next to "File name extensions." On a Mac, open Finder, click Finder in the menu bar, choose Preferences, click the Advanced tab, and check "Show all filename extensions." Once you do this, you will see the dot and the letters at the end of every filename.
What happens when you change or remove an extension
If you rename a file and accidentally delete the extension, your device will not know what program to use to open it. You might double-click it and nothing happens, or your device asks you to choose a program. The file itself is not broken — the data inside is exactly the same. You just need to add the extension back.
Changing an extension does not change what is inside the file. If you rename photo.jpg to photo.pdf, you have not turned a photo into a PDF. You have just told your device to try opening a photo with a PDF reader, which will fail. The photo is still a photo. Renaming it back to photo.jpg fixes the problem when ready.
This is why you should never change an extension to try to convert a file from one type to another. If you need to turn a photo into a PDF, you need to use a program that actually converts it — like your web browser, which can often save a photo as a PDF. Just renaming does not work.
When a file will not open and the extension might be the problem
If you read a file and double-click it but nothing happens, the extension might be wrong, or the program that reads that file type might not be installed. Check the extension first. If it looks wrong — like a photo ending in .txt — you can try renaming it to the correct extension. If the extension looks right but the file still will not open, you probably need to install the program that reads that file type.
For example, if you read a file ending in .xlsx but you do not have Excel or another spreadsheet program installed, your device will not know what to do with it. You would need to install a spreadsheet program first. Many file types have free programs that can open them — you do not always need to buy expensive software.
Sometimes a file is corrupted, meaning the data inside is damaged and cannot be read. In that case, the extension is correct but the file itself is broken. Renaming it will not help. You would need to read the file again or ask whoever sent it to you to resend it.
Extensions on phones and tablets
Your phone or tablet almost never shows extensions. When you take a photo, the camera app saves it with an extension, but you only see the photo itself. When you read a file, your device handles the extension automatically and opens the right program.
This works because phones are designed to hide technical details. Your phone knows that a file ending in .jpg should open in the Photos app, and a file ending in .pdf should open in a PDF reader. You do not need to think about it.
If you need to see or change an extension on a phone, you would need to connect it to a computer and use File Explorer or Finder. Most people never need to do this. If a file will not open on your phone, the problem is usually that the program that reads that file type is not installed, not that the extension is wrong.
Why extensions matter for security
Criminals sometimes hide dangerous files by giving them fake extensions. A file might actually be a program that damages your device, but it is named invoice.pdf to trick you into opening it. This is why you should never open a file from someone you do not trust, even if the extension looks harmless.
If you receive an email with an attachment and you were not expecting it, do not open it. If the extension is .exe or .zip, be especially careful — these are common ways to send harmful files. When in doubt, ask the person who sent it whether they really meant to send it to you.
Frequently Asked Questions
Can I change a file's extension to convert it to a different format?
No. Changing the extension does not convert the file — it only tells your device to try opening it with a different program. If you need to convert a photo to PDF or a Word document to PDF, you need to use a program designed to do that conversion, like your web browser or a dedicated converter.
What should I do if a file has no extension?
If a file has no extension, your device will not know what program to use to open it. You can try right-clicking the file, choosing "Open with," and selecting a program manually. If you know what type of file it is, you can also try adding the extension yourself — rename the file and add a dot and the letters at the end.
Why do some files have two extensions, like document.tar.gz?
Some files are compressed or packaged in multiple layers. .tar.gz means the file was first turned into a tar archive, then compressed with gzip. You need to unpack both layers to get to the actual file inside. Your device usually handles this automatically when you open it.
Is it safe to open a file if I do not recognize the extension?
Be cautious. If someone sent you the file and you were not expecting it, ask them first. If the extension is something you have never seen before, you can search for it online to learn what it is. Never open a file from an untrusted source, even if the extension looks normal — criminals can hide dangerous files under harmless-looking names.
What if my device shows a different extension than what I named the file?
This usually means your device added an extension automatically when you saved the file. For example, if you save a document in Word and name it "report," Word automatically adds .docx, so the full filename becomes report.docx. This is normal and expected.