Files, Storage and Formats

What File Extensions Tell You

What the letters at the end of a file name mean, how your computer uses them, why renaming does not convert a file, and how hidden extensions can mislead.

On this page
  1. What an extension is
  2. What your computer does with it
  3. Some common ones
  4. Renaming is not converting
  5. Why a program may not open a file
  6. Hidden extensions and why they can mislead
  7. Safer habits
  8. What an extension does not tell you

What an extension is

A file extension is the short group of letters after the last dot in a file name, such as .txt, .jpg, .pdf or .docx. It usually describes the file’s format, meaning how the information inside is arranged.

The extension is part of the name, not part of the contents. It is a label attached by convention. That single fact explains most of what follows.

What your computer does with it

Operating systems commonly use the extension to decide which program should open a file and which icon to show. When you double-click a file ending in .xlsx, your system looks up which application is set to handle that extension and launches it. If nothing is assigned, you get a prompt asking how to open it.

Extensions also help you at a glance. Seeing .mp3 tells you to expect audio, and .zip suggests an archive. Websites and email systems may use them to decide what to allow or block.

Phones and tablets tend to hide extensions and show a friendly type description, but the same labelling system generally exists underneath.

Some common ones

Extension Typically means
.txt Plain text
.docx Word-processor document
.xlsx Spreadsheet
.pdf Fixed-layout document
.jpg, .jpeg, .png, .webp Image formats
.gif Image, often animated
.mp3, .m4a, .wav Audio
.mp4, .mov Video
.zip Archive of other files
.exe, .msi Programs or installers on Windows
.app, .dmg Apps and disk images on Apple computers
.html Web page

The same extension can sometimes cover different things, and one format can have several extensions, as with .jpg and .jpeg, which mean the same thing.

Renaming is not converting

Changing the extension changes only the label. If you rename holiday.png to holiday.jpg, the contents are still PNG data. Some programs will open it anyway because they check the actual contents, while others will complain that the file is damaged. The same applies to renaming a Word document to .pdf: it will not become a PDF.

To really change format you need to open the file in a suitable program and use Save As or Export, or use a conversion tool. Converting between lossy formats, or from a lossy one to a lossless one, may affect quality, as with image formats.

Why a program may not open a file

If a file will not open, the extension often gives the first clue:

  • You may lack software that supports the format. A free viewer or a different app might help.
  • The extension may be wrong or missing, perhaps after a download or transfer.
  • The file may be damaged, or may have been created by a newer version of a program than yours.
  • The file might be an unusual or specialist format. A quick online search of the extension typically explains what it is.

Without an extension, the system may guess the type from the first few bytes of the file, often called a signature or magic number. That is not reliable for every format.

Hidden extensions and why they can mislead

Windows and macOS can both be set to hide extensions for known file types, and many people never change the setting. Hiding is tidy, but it creates a risk. A file named invoice.pdf.exe will, with extensions hidden, appear as invoice.pdf. Because only the last extension is the real one, this is a program, not a document. Attackers use this trick in phishing emails and elsewhere, often alongside an icon chosen to resemble a PDF or a folder.

Similar tricks include very long names that push the real extension out of view, and using characters that make part of a name read backwards. Archives such as zip files can also conceal a program inside.

Showing full extensions is a simple precaution. In Windows, the File Explorer view options include an option for file name extensions. On macOS, the Finder settings have a similar option under advanced. Menus change between versions, so check your system’s help if you cannot find it.

Safer habits

  • Turn on extension display, so you always see the true ending.
  • Treat unexpected programs and scripts with suspicion: extensions such as .exe, .msi, .bat, .cmd, .scr, .js and .vbs can run code. Documents with macros, such as .docm and .xlsm, deserve care too.
  • Be careful with email attachments you did not expect, even from people you know, since their account may be compromised.
  • Do not trust the icon or the name alone. Check the file’s properties or details for its type and size. A document that is only a few kilobytes but claims to be a long report may be something else.
  • Download from sources you trust, and keep your security software and software updates current so known problems are handled.
  • If you are unsure, scan the file with your security tool before opening it, or leave it alone. Even these precautions cannot guarantee safety, but they reduce the risk.

What an extension does not tell you

It does not prove what is inside, whether it is safe, or which version of a format it uses. It also says nothing about who made it or whether it has been altered. It is a handy signpost, not a guarantee. Reading the real extension, and knowing that renaming changes only the label, is enough to avoid most confusion and a good share of the risks.

The complete guide to files, storage and formats

A Plain Guide to Digital Files, Folders and Formats
Read the guide

Keep exploring

Guides from other topics

All topics →