File extension

Updated: 10/01/2023 by Computer Hope
The .txt file extension.

A file extension or file name extension is the ending of a file that helps identify the file type in operating systems such as Microsoft Windows. In Microsoft Windows, the file name extension is a period often followed by three characters but may also be one, two, four, or more characters long.

Example of a file extension

For example, the file name "myfile.txt" has a file extension of ".txt," a file name extension associated with text files.

File list in explorer with name and file extension

In the example above, the first file shown in Explorer is the "Regedit.exe" file. "Regedit" is the file name, and ".exe" is the file extension identifying this file as an executable file. The next file, "RtlExUpd.dll," is a DLL (dynamic-link library) file and the last two are log files. By having file name extensions, you can quickly identify the type of file and better understand how that file may be opened.

Tip

If you are trying to find a file with a specific extension, use wildcards in your search.

What makes a valid file name extension?

A file name extension is often between one and three characters and is always at the end of the file name, starting with a period. Some programs also support file extensions that are more than three characters. For example, all the latest versions of Microsoft Word support .docx document files, and some web pages end with the .html file extension.

Note

In all new versions of Microsoft Windows, the file extensions are hidden by default, and you must have show file extensions enabled. For help enabling this feature, see: How to view a computer file extension.

Can a file extension be longer than three or four characters?

Yes. As long as the program was designed to use a longer file extension, it can be longer than four characters. However, most programs do not exceed four characters to keep the overall file name short.

Is there a limit to how long a file extension can be?

There is no file extension limit as long as the file path, name, and extension combined do not exceed the operating system's maximum file name character limit. Below lists Microsoft Windows versions and their file name character limit.

Windows 10 - 260 character limit.
Windows 8 - 260 character limit.
Windows 7 - 260 character limit.
Windows Vista - 260 character limit.
Windows XP - 255 character limit.
Windows 2000 - 254 character limit.

How many types of file extensions are there?

There are thousands of file extensions associated with one or more applications. More common file extensions you're likely to encounter are listed below.

Picture files

Music and sound files

Operating system files

Text and word processing documents

Spreadsheet files

Web Page files

Note

For a list of common file extensions, see: What are the most common file types and file extensions? For a full list of file extensions, see: Computer file extensions information and listing.

How to add a file extension

To add a file extension, rename the file and add the extension you want to associate with the file. For example, if the file was named "example," we could rename it to "example.txt," and it would be treated as a text file. Realize that when you rename the file, it does not change the file type. In other words, you cannot rename a .txt file to a .mp3 file and expect that file to become an audio file. To change a file type into another file type, it must be converted.

How to remove a file extension

A file extension can be removed by renaming a file. However, programs rely on file extensions for identification, and removing the extension could cause the computer not to know what program to use to view the file.

Tip

In Microsoft Windows, another option is to hide the file extensions from being shown.

Does a directory have an extension?

No. A directory does not have an extension like a file.

Extension, File, File format, File name, Ftype, Operating system terms, Software terms