What Is a File Extension & Why Are They Important? (original) (raw)

A file extension, sometimes called a file suffix or a filename extension, is the character or group of characters after the period that makes up an entire file name. Some common file extensions include PNG, MP4, PDF, MP3, DOC, SVG, INI, DAT, EXE, and LOG.

Why Are File Extensions Used?

The file extension helps an operating system, like Windows or macOS, determine which program on your computer the file is associated with.

For example, the file notes.docx ends in docx, a file extension that's associated with Microsoft Word on your computer. When you attempt to open this file, Windows sees that the file ends in a DOCX extension, which it already knows should be opened by Word.

File extensions also often indicate the file type, or file format, of the file, but not always. Any file's extension can be renamed, but that won't convert the file to another format or change anything about the file other than this portion of its name.

Various Files in Windows.

File Extensions vs File Formats

File extensions and file formats are often spoken about interchangeably. This is usually okay, but in reality, a file extension is just the characters that appear after the period, while the file format speaks to the way in which the data in the file is organized.

For example, in the file name data.csv, the file extension is csv, indicating that this is a CSV file. A computer user could rename that file to data.mp3, however, that wouldn't mean you could play the file as some sort of audio on a smartphone. The file itself is still rows of text (a CSV file), not a compressed musical recording (an MP3 file).

Changing the Program That Opens a File

File extensions help Windows, or other operating systems you're using, determine which program to use to open those types of files. Most file extensions, especially those used by common image, audio, and video formats, are usually compatible with more than one program you have installed.

If there are multiple programs that can open a file, you can open them using a program of your choice in Windows by changing the file association.

Another way to make a file open with a different program is to rename the file extension. For example, if you have an RTF file that's opening in WordPad, but you instead want it to always open in Notepad, you can rename the file to file.txt since Notepad recognizes TXT files and not RTF files.

There are a couple of ways to do that in Windows, but the easiest method is to disable the "hide extensions for known file types" option so that you can see the file extension after the file name, and change it to whatever you want.

Here's how:

  1. Open the Run dialog box via WIN + R.
  2. Enter control folders.
  3. From the View tab, remove the check next to Hide extensions for known file types.
  4. Select OK.

Windows also lets you change a file extension from the command line. Just type ren in Command Prompt, followed by the current filename and then the new one, including the new file extension you want it to have. See our Rename Command article for more information on doing this.

macOS and Linux deal with file extensions a bit differently than Windows because they don't rely on one to know how to open a file. Regardless, you can still choose a different program to open the file with, and on a Mac, you can also view or hide file extensions.

In macOS, right-click the file and select Open With to see a selection of programs you can use to open the file (including the default program option). If you're using Ubuntu, and possibly other versions of Linux, right-click the file and select Open With Other Application.

To view file extensions on a Mac as you're browsing your files, open the Finder menu, go to Preferences, and then from the Advanced tab you want to check the box next to Show all filename extensions.

Converting Files From One Format to Another

Simply renaming a file to change its extension won't change what type of file it is, even though it might appear as though that happened when Windows shows the icon associated with the new file extension.

To truly change the type of file, it has to be converted using a program that supports both types of files or a dedicated tool designed to convert the file from the format it's in to the format you want it to be in.

For example, let's say you have an SRF image from your Sony digital camera, but a website you want to upload the image to only allows JPEGs. You could rename the file from filename.srf to filename.jpg.

Windows puts a limit on how many characters can come after the period to make up the file extension. It's a combination of the file name, extension, and path to the file. Modern versions of Windows cap this total character limit at 260, except for Windows 11 and 10 which can exceed it after a registry edit.

To convert the file from SRF to JPEG, you would need to find a program that fully supports both so you could open the SRF file and then export or save the image as JPG/JPEG. In this instance, Photoshop is a perfect example of an image manipulation program that could do this job.

If you don't have access to a program that natively supports both formats you need, many dedicated file conversion programs are available.

Executable File Extensions

Some file extensions are classified as executable, meaning that when opened, they don't just launch for viewing or playing. Instead, they actually do something all by themselves, like install a program, start a process, run a script, etc.

Because files with these extensions are just a single step away from doing lots of things to your computer, you have to be very careful when you receive executable file extensions like this from a source you don't trust.

Identifying Viruses by the File Extension

It's important to really examine the full filename before opening a file if you're not sure what it is. The biggest takeaways are to ensure you notice the real file extension (whatever comes after the period), and to research the file extension if you're unfamiliar with it.

For example, video.mp4is clear it's an MP4 video, but video.mp4.exe is very different, despite the small filename difference. Since the details after the period identify the file extension, this might really be an EXE file disguised as a video, which should be avoided, since it's likely trying to fool you into opening it.

On an opposite note, some file extensions look strange, but they're actually completely normal and don't necessarily mean the file is harmless. CATDRAWING and CRDOWNLOAD, for example, are far longer than most file extensions, Z is much shorter, and 000 contains only numbers.

FAQ

Thanks for letting us know!

Get the Latest Tech News Delivered Every Day

Subscribe