A filename extension tells your computer what kind of file it is

A filename extension is the short code at the end of a filename, after the dot. It tells your computer what program should open the file and how to read the data inside. For example, a file named budget.xlsx has the extension .xlsx, which means it is a spreadsheet. A file named photo.jpg has the extension .jpg, which means it is a photograph.

Without the extension, your computer would not know whether to open a file as text, an image, a video, or something else entirely. The extension is not part of the actual filename — it is metadata that your operating system uses to match the file to the right program.

Most of the time you do not have to think about extensions. When you save a file in Microsoft Word, it automatically adds .docx. When you take a photo on your phone, it automatically adds .jpg or .heic. But understanding what extensions do helps you organize files, troubleshoot problems, and move files between different programs.

Key Takeaways

  • A filename 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, .xlsx for spreadsheets, .jpg for photos, .mp4 for videos, and .pdf for portable documents.
  • Changing or removing an extension does not change what the file actually is — it only changes what program your computer tries to open it with.
  • On Windows, you can show or hide extensions in File Explorer settings; on Mac, extensions are usually hidden by default but can be revealed.
  • If a file will not open, the wrong extension is often the problem, and renaming it to the correct one usually fixes it.

How extensions work on Windows and Mac

On Windows, filename extensions are usually visible by default. When you look at a file in File Explorer, you see the full name including the dot and the letters after it. You can hide extensions if you want — go to View in File Explorer, click Options, then choose Change folder and search options. Under the View tab, uncheck "Hide extensions for known file types."

On Mac, extensions are hidden by default in Finder. To see them, open Finder, click Finder in the menu bar, then Preferences. Under the Advanced tab, check "Show all filename extensions." Once you do this, you will see the extension on every file.

Showing extensions is usually the better choice, especially if you work with many different file types. It makes it much easier to spot when a file has the wrong extension or when a file is missing one entirely.

Common extensions and what they mean

Different types of files use different extensions. Here are the ones you will encounter most often:

Documents: .docx is a Word document, .doc is an older Word format, .txt is plain text, .pdf is a portable document that looks the same on any computer, and .odt is an open-source document format.

Spreadsheets: .xlsx is an Excel spreadsheet, .xls is an older Excel format, .csv is comma-separated values (a simple format that most programs can read), and .ods is an open-source spreadsheet.

Images: .jpg is a compressed photograph, .png is an image with a transparent background, .gif is an animated image, .bmp is an uncompressed image, and .svg is a vector image that scales without losing quality.

Video and audio: .mp4 is a video file, .mov is a video from Apple devices, .avi is an older video format, .mp3 is an audio file, and .wav is uncompressed audio.

Compressed files: .zip is a compressed folder that holds multiple files, and .rar is another compressed format.

What happens when you change an extension

Changing a filename extension does not actually change the file itself — it only changes what program your computer tries to open it with. If you rename photo.jpg to photo.txt, the file is still a photograph. Your computer will try to open it as text, and you will see gibberish. But the actual image data is unchanged.

This matters because it means you can sometimes fix a file that will not open by giving it the correct extension. If you have a file called document with no extension, and you know it is a Word document, you can rename it to document.docx and it will probably open in Word.

However, you cannot convert a file by changing its extension. If you have a .jpg photo and rename it to .png, it will not become a true PNG file — it will just be a JPG file that your computer tries to open as a PNG. To actually convert a file from one format to another, you need to use a program designed for that conversion, like an image editor or a file converter.

Why extensions matter for file organization

Extensions help you organize files because they let you sort by type. In File Explorer or Finder, you can sort by file type, and all your spreadsheets will group together, all your photos will group together, and so on. This is much faster than sorting by name or date when you have hundreds of files.

Extensions also help you understand at a glance what a file is. If you see a file named 2024_report.xlsx, you know immediately it is a spreadsheet. If you see 2024_report with no extension, you have to open it or check its properties to know what it is.

When you share files with other people, the extension tells them what program they need to open it. If you send someone a .docx file, they know they need Word or a compatible program. If you send a .pdf, they know it will look the same on any device.

When extensions cause problems

The most common problem is a file with the wrong extension. This usually happens when you download a file and the browser or email program guesses the wrong type, or when you manually rename a file and make a typo. The file will not open, or it will open in the wrong program and show garbage.

Another problem is a missing extension. Some programs or websites strip the extension when you save or download a file. The file is still there and still works, but your computer does not know what program to use, so double-clicking it does nothing. You can fix this by renaming the file and adding the correct extension.

A third problem is an unfamiliar extension. If you receive a file with an extension you have never seen, you may not know what program opens it. You can search the extension online — for example, searching ".webp" will tell you it is an image format — or you can try right-clicking the file and choosing "Open with" to see what programs are available.

Extensions and file security

Filename extensions can hide dangerous files. A malicious program might be named invoice.pdf.exe. If your computer hides extensions, you see only invoice.pdf and think it is a document. But the actual file is an executable program that could harm your computer.

This is one reason to keep extensions visible — it helps you spot when a file is not what it claims to be. Be suspicious of any file that has two extensions, especially if the second one is .exe, .bat, .cmd, or .scr. These are executable files that run programs, and they should only come from sources you trust.

If you receive an unexpected file from someone you do not know, do not open it, even if the extension looks harmless. Malware creators often disguise executable files with innocent-looking names.

Frequently Asked Questions

Can I open a file with a different extension than it was made for?

Sometimes, but not always. Some file formats are compatible — for example, many programs can open both .doc and .docx files. But if you try to open a .jpg photo as a .txt text file, it will not work. The file will not convert; your computer will just try to read image data as text and show gibberish.

What if a file has no extension at all?

Your computer may not know what program to use to open it. You can try right-clicking the file and choosing "Open with" to pick a program manually. If you know what type of file it is, you can rename it and add the correct extension, and then it should open normally.

Do I need to keep the extension when I rename a file?

Yes. If you rename budget.xlsx to 2024_budget and accidentally delete the .xlsx, the file will not open in Excel anymore. Always keep the extension, or at least add it back before you save the rename.

Why do some files have two extensions?

Usually because the file was compressed or archived. A file named document.docx.zip is a Word document that has been compressed into a zip folder. You need to unzip it first to get back to the .docx file. Occasionally two extensions appear because of a mistake in saving or downloading.

Can I change a .jpg photo to a .png by renaming it?

No. Renaming changes only what program tries to open the file, not what the file actually is. To convert a JPG to a true PNG, you need to use an image editor or converter that reads the JPG data and writes it in PNG format. Simply renaming it will not do that conversion.