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 .doc, .jpg, or .mp4. That ending is the file extension. It is the instruction 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" is a photo, a video, a text document, or something else entirely. The extension is not decoration — it is the label that makes the file work.

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 .txt for text, .jpg for photos, .pdf for documents, 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, extensions are often hidden by default, but you can turn on the option to see them in File Explorer settings.
  • Different programs can open the same file type, but the extension stays the same regardless of which program you use.

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 machine to find one that knows how to read that file type. If you have Microsoft Word installed and you double-click a file ending in .docx, Windows or Mac will automatically open Word because it recognizes that extension.

The extension is a promise about what is inside the file. A .jpg file contains image data in a specific format. A .xlsx file contains spreadsheet data. A .mp3 file contains audio. Your computer trusts the extension and does not check the actual contents — which is why renaming a file with the wrong extension can cause problems.

Common file extensions and what they mean

You will encounter certain extensions repeatedly. Text files use .txt for plain text with no formatting, and .doc or .docx for Microsoft Word documents. Photos are usually .jpg, .png, or .gif. Videos are often .mp4, .mov, or .avi. Audio files are .mp3, .wav, or .flac.

Compressed files — folders that have been squeezed down to save space — use .zip. Web pages are .html. Spreadsheets are .xlsx or .csv. Presentations are .pptx. Portable documents that look the same on any computer are .pdf. Each extension signals a different structure and a different set of programs that can open it.

Why you might not see file extensions on your computer

Windows and Mac hide file extensions by default for most users. This is meant to make filenames look cleaner, but it can cause confusion when you are trying to understand what a file actually is. On Windows, you can turn extensions back on by opening File Explorer, clicking the View tab at the top, and checking the box next to "File name extensions." On Mac, open Finder, go to Preferences, and check "Show all filename extensions."

Turning extensions on is useful when you are downloading files, renaming them, or troubleshooting why a file will not open. Once you see the extension, you immediately know what you are working with.

What happens when you change or remove an extension

Renaming a file and changing its extension does not actually change what the file is. If you rename "photo.jpg" to "photo.txt," you have only changed the label. The file still contains image data. When you try to open it, your computer will look at the .txt extension, assume it is text, and either fail to open it or display garbage on the screen.

The only time you should change an extension is when you are deliberately converting a file from one format to another using the right software. For example, you might use an image editor to open a .jpg and save it as a .png. The software does the actual conversion. Simply renaming the extension yourself will not do that work.

Multiple programs can open the same file extension

Many file types can be opened by more than one program. A .pdf file can open in Adobe Reader, your web browser, or dozens of other programs. A .jpg photo can open in your default photo viewer, Photoshop, Paint, or any image editor. The extension stays the same no matter which program you use.

If a file is not opening in the program you want, you can right-click it (or Control-click on Mac), select "Open with," and choose a different program from the list. This does not change the extension — it only tells your computer to use a different program this time. If you want to change the default program permanently, you can do that in your system settings.

Case sensitivity and file extensions

On Windows, file extensions are not case-sensitive. A file named "document.PDF" and one named "document.pdf" are treated identically. On Mac and Linux, extensions are technically case-sensitive, but most programs do not care about the difference in practice.

The safest habit is to use lowercase letters in extensions, since that is the standard across all systems. If you ever need to move a file between Windows and Mac, or share it with someone on a different system, lowercase extensions prevent any confusion.

Frequently Asked Questions

Can I remove the file extension entirely?

Technically yes, but your computer will no longer know what program to use to open the file. You can delete the dot and letters, but the file will become unusable. It is not recommended unless you have a specific technical reason to do it.

What if a file has two extensions, like document.tar.gz?

Some files use compound extensions because they have been processed twice. A .tar.gz file has been archived and then compressed. Your computer reads the rightmost extension first, so it will look for a program that handles .gz files. That program will then extract the .tar file inside. You usually do not need to worry about this — just double-click and let your computer handle it.

Why do some files not have an extension?

Some files, especially on Mac and Linux, work without extensions because the system can read the file's internal structure to determine its type. Windows relies more heavily on extensions, so a file without one may not open properly. If you download a file without an extension and cannot open it, try adding the correct extension based on what the file should be.

Is it safe to change a file extension to hide what type of file it is?

Changing an extension does not actually hide the file's contents from someone who knows what they are looking at, and it will break the file for normal use. If you need to protect a file, use encryption or password protection instead of renaming the extension.

What if my computer does not recognize a file extension?

This usually means you do not have a program installed that can open that file type. Search online for the extension to learn what it is, then download the appropriate program. Be cautious about downloading software — stick to official sources and reputable sites.