Nepedia
Back to Discover
Advanced Reader
💻

Filename extension

technology Maturity 11-13 Next article →

A filename extension is a suffix added to the end of a computer file name. It serves as a label to indicate the contents of a file or its intended use. These extensions are typically separated from the main name by a full stop, also known as a period. For example, a file named "readme.txt" uses the extension ".txt" to signal it is a text file. While these suffixes are highly useful for human users, they are actually a form of metadata. Metadata is information that describes other data. In many modern systems, the extension is just one way to identify a file, as many files contain internal metadata that describes their own format.

How a computer handles these extensions depends heavily on its file system. Some older file systems treat the extension as a distinct part of the file's identity. For instance, the FAT file system used in DOS and 16-bit Windows implements extensions as a specific feature. In these systems, filenames followed an "8.3" rule. This meant a name could have a maximum of eight characters, followed by a period, and an extension of up to three letters. However, the period itself was not actually stored by the system. In contrast, many other systems treat the extension as just more characters in a single string. Unix-like systems, VFAT, and NTFS treat the extension as part of the filename without any special distinction. In these environments, the period is simply another character that can appear anywhere in the name.

Different operating systems have developed unique ways to manage file identification. The Multics file system allowed for variable-length filenames and could even include multiple dots. This meant a file could have no suffix at all, or it could have multiple suffixes. The classic Mac OS took a different approach entirely. It did not use filename-based extensions to identify file formats. Instead, it used a distinct file type code and a creator code. The creator code determined which specific application would launch when a user double-clicked the file icon. Modern macOS uses a combination of these methods, including filename suffixes and Uniform Type Identifiers, because it is derived from the UNIX-like NeXTSTEP system.

History shows how these naming conventions have evolved alongside computing power. Early systems like CTSS stored the filename and file type separately. This practice continued through DEC operating systems like RT-11, as well as CP/M and DOS. A major shift occurred with the arrival of Windows 95. This version introduced VFAT, which supported long filenames and removed the strict 8.3 limit for non-NT Windows. Even as newer systems like NTFS and ReFS were developed, they continued to use the suffix convention. They did this to ensure compatibility with existing versions of Windows. Even the High Performance File System (HPFS) used in OS/2 supported extended attributes, yet the convention of using suffixes remained the standard.

Sometimes, a single file may appear to have more than one extension. This is often seen in cases of nested transformations. For example, a file named "files.tar.gz" uses two suffixes. The ".tar" indicates that the file is a tar archive containing one or more files. The ".gz" indicates that this archive has been compressed using a tool called gzip. While some authors define an extension in a way that does not allow more than one per name, these nested labels are common in practice. However, users should be careful because some extensions are not unique. The extension ".rpm" can refer to both RPM Package Manager packages and RealPlayer Media files. Similarly, ".qif" can represent DESQview fonts, Quicken financial ledgers, or QuickTime pictures.

In the world of internet communication, filename extensions are often replaced by MIME types. MIME stands for Multipurpose Internet Mail Extensions. When transferring data via protocols like HTTP, the system uses a "Content-type" line to state the media type of the stream. For example, a server might send "text/plain" to identify a text file. There is no standard mapping between filename extensions and MIME types, which can cause mismatches. If a web server does not recognize a specific extension, like "svgz" for a compressed vector graphic, it might fail to send the correct content type. This can leave web browsers unable to interpret or display the file correctly. To solve this, some desktop environments use a heuristic approach. They examine both the suffix and the actual contents of the file to decide which application to launch.

Finally, it is vital to understand the security implications of filename extensions. An extension is not a reliable indicator of what a file actually contains. A user can easily change an extension to disguise malicious content. Because of this risk, cybersecurity experts look for a "magic number." A magic number is a distinctive sequence of bytes located in the file's header. This internal signature allows the computer to identify the true file format regardless of what the filename says. Relying solely on the suffix can lead to errors or security vulnerabilities, making internal metadata a much more robust method for file identification.

855 words

Where will your curiosity go next?

Keep exploring at your chosen reading level.

More to explore

🔬 Go deeper

More advanced topics to explore

🪜 Step back

Simpler topics to build understanding

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.