Filename extension

A filename extension is the trailing portion of a filename, following a period character, which is used to indicate the kind of data stored in the file.

History
Many operating systems, including Unix,, Microsoft Windows, and Linux, use filename extensions of one or more alphanumeric characters. Older operating systems, such as MS-DOS, did not support more than three. Examples include "c" for C source code, "ps" for PostScript, and "txt" for plain text.

Apart from informing the user what type of content the file holds, filename extensions are typically used to decide which program to launch when a file is "run", e.g. by double-clicking it in a GUI file manager. They are also used by the program in Unix to determine how to build one kind of file from another.

Filename extensions in Mac OS
Classic Mac OS avoided relying on filename extensions, and identified file types and their associated applications through type and creator codes, respectively. The codes each consisted of 4 alphanumeric characters that were normally hidden from end users, and required a utility, such as ResEdit, to modify them.

NeXTSTEP and its descendants, such as Mac OS X and macOS, used filename extensions that could be longer than 3 alphanumeric characters, and could optionally be hidden from the user. The default application to open a specific file type defined by a filename extension can be set in the Get Info dialog box in the Finder. Directories can also be given an extension and "packaged" to appear as a single file, such as an application, to the user.