WIPIVERSE All articles

Filename extension

A filename extension is a suffix appended to the name of a computer file, typically separated from the base filename by a period (dot), that indicates the file's format, type, or intended use. It serves as a metadata hint to the operating system, applications, and users regarding the internal structure of the file's data.

Structure and Syntax In most modern file systems (such as FAT, NTFS, ext4, APFS), the extension is not a distinct filesystem attribute but a naming convention. The extension consists of the characters following the last period in the filename (e.g., in document.txt, the extension is txt). While early operating systems (such as CP/M, MS-DOS, and classic Mac OS) imposed strict length limits (e.g., the 8.3 format limiting extensions to three characters), contemporary systems generally allow variable lengths and multiple periods within the filename.

Function and Usage

  • File Association: Graphical user interfaces (GUIs) and command-line shells use extensions to associate files with specific applications (e.g., opening .html files in a web browser).
  • **MIME Type Mapping: Web servers and email clients map extensions to Multipurpose Internet Mail Extensions (MIME) types (e.g., .json to application/json) to inform recipients how to process the content.
  • Execution Policy: Operating systems often use extensions to determine executability. For example, Windows treats .exe, .bat, and .cmd as executable, while Unix-like systems rely primarily on filesystem permission bits, though extensions like .sh or .py denote script interpreters.

Limitations and Security A filename extension does not guarantee the actual content of a file. A user can rename image.png to document.pdf without altering the binary data. Consequently, robust software identifies file types by inspecting "magic numbers" (file signatures) in the header bytes rather than relying solely on the extension. This discrepancy is frequently exploited in malware distribution (e.g., naming an executable invoice.pdf.exe and hiding known extensions in the OS settings to display only invoice.pdf).

Visibility By default, some operating systems (notably Microsoft Windows) hide extensions for registered file types to simplify the user interface. This behavior can be disabled to display the full filename, a practice recommended for security awareness and technical troubleshooting.

Browse

More topics to explore

    Browse all articles