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 ending is the file extension. It is a label that tells your operating system which program should open the file and how to read the data inside it. Without the extension, your computer would have no way to know whether a file contains a word document, a spreadsheet, or an image.

Extensions are not decorative. They are instructions. When you double-click a file with a .pdf extension, Windows or Mac knows to open it with a PDF reader. When you click a .xlsx file, it opens in a spreadsheet program. The extension is how your computer matches files to the programs that can handle them.

Most of the time you do not need to think about extensions — they are added automatically when you save a file. But understanding what they are helps you troubleshoot when a file will not open, when you need to convert between formats, or when you are moving files between different devices or programs.

Key Takeaways

  • A file extension is the letters after the final dot in a filename, and it identifies what type of file it is to your computer.
  • Common extensions include .docx for Word documents, .jpg for photos, .mp4 for videos, and .xlsx for spreadsheets.
  • Your computer uses the extension to decide which program opens the file, so a missing or wrong extension can prevent the file from opening.
  • You can change a file extension by renaming the file, but changing it does not convert the file — it only changes the label.
  • Some devices and programs hide extensions by default, but you can turn on the option to see them in your file manager settings.

How extensions work with your operating system

Your computer maintains a list of file types and which programs handle each one. When you save a file in Microsoft Word, Word adds the .docx extension automatically. Later, when you click that file, your operating system reads the extension, looks it up in that list, and launches Word to open it.

This system works because the extension is a promise about what is inside the file. A .jpg file contains image data in JPEG format. A .txt file contains plain text with no formatting. A .zip file contains compressed data. Your computer trusts the extension and acts on it.

If the extension is wrong or missing, the file may not open at all, or it may open in the wrong program. For example, if you rename a .docx file to .txt, your computer will try to open it as plain text, and you will see gibberish instead of a formatted document. The file itself has not changed — only the label has.

Common file extensions and what they mean

You will encounter the same extensions repeatedly. Learning the most common ones helps you understand what kind of file you are working with at a glance.

ExtensionFile TypeWhat It Contains
.docxWord DocumentText with formatting, created in Microsoft Word
.pdfPDF DocumentFormatted document that looks the same on any device
.xlsxExcel SpreadsheetData organized in rows and columns, with formulas
.jpg or .jpegJPEG ImageCompressed photo or image
.pngPNG ImageImage with transparent background, higher quality than JPEG
.mp4Video FileVideo with audio, plays on most devices
.mp3Audio FileMusic or voice recording
.zipCompressed ArchiveMultiple files squeezed into one smaller file
.exeExecutable ProgramSoftware program that runs when you open it
.txtPlain TextText with no formatting, opens in any text editor

These extensions cover most of what you will encounter on a personal computer. Each one represents a different way of storing or organizing data.

Why extensions are sometimes hidden

On Windows and Mac, file extensions are often hidden by default. You see the filename but not the .docx or .jpg part. This design choice was meant to make the interface cleaner for non-technical users, but it can make troubleshooting harder.

To show extensions 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, click Finder in the menu bar, select Preferences, click the Advanced tab, and check "Show all filename extensions." Once you turn this on, you will see the full filename including the extension for every file.

Seeing extensions is useful when you need to rename a file, check what format a document is in, or figure out why a file will not open. It takes a few seconds to turn on and can save you time later.

Changing an extension versus converting a file

You can rename a file and change its extension — right-click the file, select Rename, and type a new extension. But this is not the same as converting the file. Changing the extension only changes the label. The data inside stays the same.

If you rename a Word document from .docx to .txt, you have not turned it into a text file. You have only told your computer to treat it like one. When you try to open it, you will see formatting codes and gibberish because a text editor cannot read Word's internal structure.

To actually convert a file from one format to another, you need to open it in the original program and save it in the new format. For example, to convert a Word document to PDF, open it in Word, click File, select Save As, and choose PDF from the format dropdown. This process reads the original file and writes it in the new format.

What to do when a file will not open

If a file will not open, the extension is often the culprit. Start by checking what extension the file has. If you have hidden extensions turned on, you may not see it — turn on the display of extensions first.

Once you can see the extension, ask yourself: Do I have a program that opens this type of file? A .docx file needs Word or a compatible program like Google Docs. A .mp4 file needs a video player. If you do not have the right program, you will need to install one or use an online converter.

If the extension looks wrong — for example, a photo file ending in .txt — try renaming it back to the correct extension. If a file arrived as an email attachment and the extension is missing, you may need to add it back based on what the file actually is.

If you are moving files between a Mac and a Windows computer, or between different programs, extensions sometimes get lost or changed. Check the file on the receiving end and add or correct the extension if needed.

Extensions on phones and tablets

On iPhones, iPads, and Android devices, extensions work behind the scenes but are almost never shown to you. When you take a photo, the phone saves it as a .jpg or .heic file, but you only see the image thumbnail. When you download a document, the device handles the extension automatically.

This hidden approach works well on phones because the operating system is tightly integrated with the apps. When you tap a file, the phone knows which app to use without needing to show you the extension. However, if you move files from your phone to a computer, the extensions are still there — you just could not see them on the phone.

If you are having trouble opening a file that came from a phone, check its extension on your computer. Sometimes files from iPhones use .heic format for photos, which older Windows computers cannot open without additional software. In those cases, you may need to convert the file to .jpg first.

Frequently Asked Questions

Can I change a file extension to open it in a different program?

You can change the extension, but it will not convert the file. The data inside stays the same. If you rename a .docx file to .pdf, your computer will try to open it as a PDF, but it will show gibberish because the content is still in Word format. To actually convert between formats, open the file in the original program and save it in the new format.

What if a file has no extension?

A file without an extension can be hard to open because your computer does not know which program to use. If you know what type of file it is, you can add the extension by renaming it. Right-click the file, select Rename, and add the correct extension at the end — for example, change "document" to "document.docx". Then your computer will know how to open it.

Is it safe to change a file extension?

Changing an extension is safe in the sense that it will not damage your computer. However, it may make the file unreadable. If you change a .jpg to .txt, the file will not become a text file — it will just become unreadable. Only change an extension if you are trying to fix a mislabeled file or if you are about to convert it in the proper program.

Why do some files have double extensions like .tar.gz?

Some files use two extensions because they have been processed twice. A .tar.gz file is a folder that has been compressed twice — first with tar (a bundling tool) and then with gzip (a compression tool). You need to decompress it twice to get the original files. This is common with software downloads and backups, especially on Mac and Linux systems.

Do I need to know all file extensions?

No. You only need to recognize the extensions you use regularly — .docx, .jpg, .mp4, and a few others. If you encounter an unfamiliar extension, you can search for it online or ask the person who sent you the file what program opens it. Your computer will also suggest programs if you right-click an unknown file and select "Open with."