Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Filename extension
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Filename suffix that indicates the file's type}} {{more citations needed|date=November 2015}} A '''filename extension''', '''file name extension''' or '''file extension''' is a suffix to the [[filename|name]] of a [[computer file]] (for example, <code>[[Text file|.txt]]</code>, <code>[[MP3|.mp3]]</code>, <code>[[.exe]]</code>) that indicates a characteristic of the file contents or its intended use. A filename extension is typically delimited from the rest of the filename with a [[full stop]] (period), but in some systems<ref>{{cite book|title=z/VM 7.2 CMS Primer|id=SC24-6265-01|section=What Is a File?|section-url=https://www.ibm.com/servers/resourcelink/svc0302a.nsf/pages/zVMV7R2sc246265/$file/dmsb2_v7r2.pdf#page=23|page=7|quote=One thing you need to know about creating files with z/VM is that each file needs its own three-part identifier. The first part of the identifier is the file name. The second part is the file type. And the third part is the file mode. These three file identifiers are often abbreviated fn ft fm.|date=2021-12-05|url=https://www.ibm.com/servers/resourcelink/svc0302a.nsf/pages/zVMV7R2sc246265/$file/dmsb2_v7r2.pdf|publisher=IBM}}</ref> it is separated with spaces. Some [[file system]]s, such as the [[File Allocation Table|FAT]] file system used in [[DOS]], implement filename extensions as a feature of the file system itself and may limit the length and format of the extension, while others, such as [[Unix]] file systems, the [[VFAT]] file system, and [[NTFS]], treat filename extensions as part of the filename without special distinction. == Operating system and file system support == The [[Multics]] file system stores the file name as a single string, not split into base name and extension components, allowing the "." to be just another character allowed in file names. It allows for variable-length filenames, permitting more than one dot, and hence multiple suffixes, as well as no dot, and hence no suffix. Some components of Multics, and applications running on it, use suffixes to indicate file types, but not all files are required to have a suffix β for example, executables and ordinary text files usually have no suffixes in their names. File systems for [[UNIX-like]] operating systems also store the file name as a single string, with "." as just another character in the file name. A file with more than one suffix is sometimes said to have more than one extension, although terminology varies in this regard, and most authors define ''extension'' in a way that does not allow more than one in the same file name.{{citation needed|date=November 2023}} More than one extension usually represents nested transformations, such as <code>files.tar.gz</code> (the <code>.tar</code> indicates that the file is a [[tar (computing)|tar archive]] of one or more files, and the <code>.gz</code> indicates that the tar archive file is compressed with [[gzip]]). Programs transforming or creating files may add the appropriate extension to names inferred from input file names (unless explicitly given an output file name), but programs reading files usually ignore the information; it is mostly intended for the human user. It is more common, especially in binary files, for the file to contain [[File format#Internal metadata|internal]] or [[File format#External metadata|external]] metadata describing its contents. This model generally requires the full filename to be provided in commands, whereas the metadata approach often allows the extension to be omitted. [[Compatible Time-Sharing System|CTSS]] was an early operating system in which the filename and file type were separately stored. Continuing this practice, and also using a dot as a separator for display and input purposes (while not storing the dot), were various [[Digital Equipment Corporation|DEC]] operating systems (such as [[RT-11]]), followed by [[CP/M]] and subsequently [[DOS]]. In [[DOS]] and 16-bit [[Microsoft Windows|Windows]], file names have a maximum of 8 characters, a period, and an extension of up to three letters. The [[File Allocation Table|FAT]] file system for DOS and Windows stores file names as an 8-character name and a three-character extension. The period character is not stored. The [[High Performance File System]] (HPFS), used in Microsoft and [[IBM]]'s [[OS/2]] stores the file name as a single string, with the "." character as just another character in the file name. The convention of using suffixes continued, even though HPFS supports extended attributes for files, allowing a file's type to be stored in the file as an extended attribute. Microsoft's [[Windows NT]]'s native file system, [[NTFS]], and the later [[ReFS]], also store the file name as a single string; again, the convention of using suffixes to simulate extensions continued, for compatibility with existing versions of Windows. In [[Windows NT 3.5]], a variant of the FAT file system, called [[VFAT]] appeared; it supports longer file names, with the file name being treated as a single string. [[Windows 95]], with VFAT, introduced support for long file names, and removed the 8.3 name/extension split in file names from non-NT Windows. The [[classic Mac OS]] disposed of filename-based extension metadata entirely; it used, instead, a distinct file [[type code]] to identify the file format. Additionally, a [[creator code]] was specified to determine which application would be launched when the file's [[Icon (computing)|icon]] was [[double-click]]ed.<ref>{{cite web|url=https://livecode.byu.edu/helps/file-creatorcodes.php|title=Mac Creator and File Type codes|accessdate=2022-09-02|website=livecode.byu.edu}}</ref> [[macOS]], however, uses filename suffixes as a consequence of being derived from the UNIX-like [[NeXTSTEP]] operating system, in addition to using type and creator codes. In Commodore systems, files can only have four extensions: PRG, SEQ, USR, REL. However, these are used to separate data types used by a program and are irrelevant for identifying their contents. With the advent of [[graphical user interface]]s, the issue of file management and interface behavior arose. Microsoft Windows allowed multiple applications to be [[file association|associated]] with a given extension, and different actions were available for selecting the required application, such as a [[context menu]] offering a choice between viewing, editing or printing the file. The assumption was still that any extension represented a single file type; there was an unambiguous mapping between extension and icon. When the [[Internet]] age first arrived, those using Windows systems that were still restricted to [[8.3 filename|8.3]] filename formats had to create web pages with names ending in <code>.HTM</code>, while those using [[Mac (computer)|Macintosh]] or UNIX computers could use the recommended <code>.html</code> filename extension. This also became a problem for programmers experimenting with the [[Java (programming language)|Java programming language]], since it ''requires'' the four-letter suffix <code>.java</code> for [[source code]] files and the five-letter suffix <code>.class</code> for Java [[compiler]] [[object code]] output files.<ref>{{cite web |url=http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/javac.html |title=javac β Java programming language compiler |publisher=Sun Microsystems, Inc. |year=2004 |quote=Source code file names must have .java suffixes, class file names must have .class suffixes, and both source and class files must have root names that identify the class. |access-date=2009-05-31 }}</ref> == Content type == Filename extensions may be considered a type of [[metadata]].<ref name="Stauffer et al 2017">{{cite book|last1=Stauffer|first1=Todd|last2=McElhearn|first2=Kirk|title=Mastering Mac OS X|date=2006|publisher=John Wiley & Sons|isbn=9780782151282|pages=95β96|url=https://books.google.com/books?id=62xkJo6JXwAC&pg=PA95|access-date=2 October 2017|language=en}}</ref> They are commonly used to imply information about the way data might be stored in the file. The exact definition, giving the criteria for deciding what part of the file name is its extension, belongs to the rules of the specific [[file system]] used; usually the extension is the substring which follows the last occurrence, if any, of the [[full stop|dot character]] (''example:'' <code>txt</code> is the extension of the filename <code>readme.txt</code>, and <code>html</code> the extension of <code>index.html</code>). On file systems of some mainframe systems such as [[Conversational Monitor System|CMS]] in [[VM (operating system)|VM]], [[OpenVMS|VMS]], and of PC systems such as [[CP/M]] and derivative systems such as [[MS-DOS]], the extension is a separate [[namespace]] from the filename. Under Microsoft's [[DOS]] and [[Microsoft Windows|Windows]], extensions such as <code>[[EXE]]</code>, <code>COM</code> or <code>BAT</code> indicate that a file is a program [[executable]]. In [[OS/360 and successors]], the part of the dataset name following the last period, called the low level qualifier, is treated as an extension by some software, e.g., [[Time Sharing Option|TSO]] EDIT, but it has no special significance to the operating system itself; the same applies to Unix files in MVS. The filename extension was originally used to determine the file's generic type.{{citation needed|date=November 2015}} The need to condense a file's type into [[8.3 filename|three characters]] frequently led to abbreviated extensions. Examples include using <code>.GFX</code> for graphics files, <code>.TXT</code> for [[plain text]], and <code>.MUS</code> for music. However, because many different software programs have been made that all handle these data types (and others) in a variety of ways, filename extensions started to become closely associated with certain productsβeven specific product versions. For example, early [[WordStar]] files used <code>.WS</code> or <code>.WS''n''</code>, where ''n'' was the program's version number. Also, conflicting uses of some filename extensions developed. One example is <code>.rpm</code>, used for both [[RPM Package Manager]] packages and [[RealPlayer]] Media files;.<ref>[http://filext.com/file-extension/rpm File Extension .RPM Details] from filext.com</ref> Others are <code>.qif</code>, shared by [[DESQview]] fonts, [[Quicken]] financial ledgers, and [[QuickTime]] pictures;<ref>[http://filext.com/file-extension/qif File Extension .QIF Details] from filext.com</ref> <code>.gba</code>, shared by [[GrabIt]] scripts and [[Game Boy Advance]] ROM images;<ref>[http://filext.com/file-extension/GBA File Extension .GBA Details] from filext.com</ref> <code>.sb</code>, used for [[SmallBasic]] and [[Scratch (programming language)|Scratch]]; and <code>.dts</code>, being used for [[Torque Game Engine|Dynamix Three Space]] and [[DTS (sound system)|DTS]]. === Compared to MIME type === In many [[Internet protocol suite|Internet]] protocols, such as [[HTTP protocol|HTTP]] and [[MIME|MIME email]], the type of a bitstream is stated as the [[media type]], or MIME type, of the stream, rather than a filename extension. This is given in a line of text preceding the stream, such as ''Content-type: text/plain''. There is no standard mapping between filename extensions and media types, resulting in possible mismatches in interpretation between authors, web servers, and client software when transferring files over the Internet. For instance, a content author may specify the extension ''svgz'' for a compressed [[Scalable Vector Graphics]] file, but a web server that does not recognize this extension may not send the proper content type ''application/svg+xml'' and its required compression header, leaving web browsers unable to correctly interpret and display the image. [[BeOS]], whose [[Be File System|BFS]] file system supports extended attributes, would tag a file with its media type as an extended attribute. Some [[desktop environments]], such as [[KDE Plasma]] and [[GNOME]], associate a media type with a file by examining both the filename suffix and the contents of the file, in the fashion of the [[file (command)|file]] command, as a [[heuristic]]. They choose the application to launch when a file is opened based on that media type, reducing the dependency on filename extensions. [[macOS]] uses both filename extensions and media types, as well as [[OSType|file type codes]], to select a [[Uniform Type Identifier]] by which to identify the file type internally. == Executable programs == {{cleanup|section|reason=intractable construction|date=November 2015}} The use of a filename extension in a command name appears occasionally, usually as a side effect of the command having been implemented as a script, e.g., for the [[Bourne shell]] or for [[Python (programming language)|Python]], and the interpreter name being suffixed to the command name, a practice common on systems that rely on associations between filename extension and interpreter, but sharply deprecated<ref>[http://www.talisman.org/~erlkonig/documents/commandname-extensions-considered-harmful Commandname Extensions Considered Harmful]</ref> in [[Unix-like]] systems, such as [[Linux]], [[Oracle Solaris]], [[BSD]]-based systems, and Apple's [[macOS]], where the interpreter is normally specified as a header in the script ("[[Shebang (Unix)|shebang]]"). On association-based systems, the filename extension is generally mapped to a single, system-wide selection of interpreter for that extension (such as ".py" meaning to use Python), and the command itself is runnable from the command line even if the extension is omitted (assuming appropriate setup is done). If the implementation language is changed, the command name extension is changed as well, and the OS provides a consistent [[API]] by allowing the same extensionless version of the command to be used in both cases. This method suffers somewhat from the essentially global nature of the association mapping, as well as from developers' incomplete avoidance of extensions when calling programs, and that developers can not force that avoidance. Windows is the only remaining widespread employer of this mechanism. On systems with [[interpreter directive]]s, including virtually all versions of Unix, command name extensions have no special significance, and are by standard practice not used, since the primary method to set interpreters for scripts is to start them with a single line specifying the interpreter to use. In these environments, including the extension in a command name unnecessarily exposes an implementation detail which puts all references to the commands from other programs at future risk if the implementation changes. For example, it would be perfectly normal for a shell script to be reimplemented in Python or Ruby, and later in C or C++, all of which would change the name of the command were extensions used. Without extensions, a program always has the same extension-less name, with only the [[interpreter directive]] or [[magic number (programming)|magic number]] changing, and references to the program from other programs remain valid. == Security issues == File extensions alone are not a reliable indicator of a file's type, as the extension can be modified without changing the file's contents, such as to disguise [[malware|malicious content]]. Therefore, especially in the context of [[cybersecurity]], a file's true nature should be examined for [[file signature|its signature]], which is a distinctive sequence of bytes affixed to a file's header. This is accomplished using file identification software or a [[hex editor]], which provides a [[hex dump]] of a file's contents.<ref>{{cite book|last1=Aquilina|first1=James M.|last2=Casey|first2=Eoghan|author2-link=Eoghan Casey|last3=Malin|first3=Cameron H.|date=2008|url=https://books.google.com/books?id=lRjO8opcPzIC&q=extension%20signature&pg=PA211|title=Malware Forensics: Investigating and Analyzing Malicious Code|publisher=[[Syngress]]|pages=211, 298β299|isbn=978-1-59749-268-3|access-date=2025-02-25}}</ref> For example, on [[UNIX-like]] systems, it is not uncommon to find files with no extensions at all,<ref name="Skoudis-2004">{{cite book|last1=Skoudis|first1=Ed|last2=Zeltser|first2=Lenny|date=2004|url=https://books.google.com/books?id=TKEAQmQV7O4C&pg=PA32|title=Malware: Fighting Malicious Code|publisher=[[Prentice Hall]]|pages=32β34, 253β254|isbn=0-13-101405-6|access-date=2025-02-25}}</ref> as commands such as <code>[[file (command)|file]]</code> are meant to be used instead, and will read the file's header to determine its content.{{citation needed|date=February 2025}} Malware such as [[Trojan horse (computing)|Trojan horse]]s typically takes the form of an [[executable]], but any file type that performs [[input/output]] operations may contain malicious code. A few [[data file]] types such as [[PDF]]s have been found to be vulnerable to exploits that cause [[buffer overflow]]s.<ref name="Grimes-2001">{{cite book|last1=Grimes|first1=Roger|date=August 2001|url=https://books.google.com/books?id=1HYlDwAAQBAJ&pg=PA71|title=Malicious Mobile Code: Virus Protection for Windows|publisher=[[O'Reilly Media]]|pages=41β42, 71β74, 221β222, 395β396, 422|isbn=1-56592-682-X|access-date=2025-02-25}}</ref> There have been instances of malware crafted to exploit such vulnerabilities in some Windows applications when opening a file with an overly long, unhandled filename extension. [[File manager]]s may have an option to hide filenames extensions. This is the case for [[File Explorer]], the file browser provided with [[Microsoft Windows]], which by default does not display extensions. Malicious users have tried to spread [[computer virus]]es and [[computer worm]]s by using file names formed like <code>[[ILOVEYOU|LOVE-LETTER-FOR-YOU.TXT.vbs]]</code>. The idea is that this will appear as <code>LOVE-LETTER-FOR-YOU.TXT</code>, a harmless text file, without alerting the user to the fact that it is a harmful computer program, in this case, written in [[VBScript]].<ref name="Grimes-2001"/> The default behavior for [[ReactOS]] is to display filename extensions in [[Windows Explorer|ReactOS Explorer]]. Later Windows versions (starting with [[Windows XP Service Pack 2]] and [[Windows Server 2003]]) included customizable lists of filename extensions that should be considered "dangerous" in certain "zones" of operation, such as when [[download]]ed from the [[World Wide Web|web]] or received as an e-mail attachment. Modern [[antivirus software]] systems also help to defend users against such attempted attacks where possible.{{citation needed|date=February 2025}} A virus may couple itself with an executable without actually modifying the executable. These viruses, known as ''companion viruses'', attach themselves in such a way that they are executed when the original file is requested. One way such a virus does this involves giving the virus the same name as the target file, but with a different extension to which the operating system gives priority, and often assigning the former a "hidden" [[file attribute|attribute]] to conceal the malware's existence. The efficacy of this approach depends on whether the user attempts to open the intended file by entering a command and whether the user includes the extension. Later versions of DOS and Windows check for and attempt to run <code>[[COM file|.COM]]</code> files first by default, followed by <code>.EXE</code> and finally <code>[[batch file|.BAT]]</code> files. In this case, the infected file is the one with the <code>[[COM file|.COM]]</code> extension, which the user unwittingly executes.<ref name="Skoudis-2004"/><ref name="Grimes-2001"/> Some viruses take advantage of the similarity between the "[[.com]]" [[top-level domain]] and the <code>.COM</code> filename extension by emailing malicious, executable command-file attachments under names superficially similar to URLs (''e.g.'', "myparty.yahoo.com"), with the effect that unaware users click on email-embedded links that they think lead to websites but actually download and execute the malicious attachments.{{citation needed|date=February 2025}} == See also == * [[file (command)]] * [[List of file formats]] * [[List of filename extensions]] * [[Metadata]] * [[.properties]] == References == {{Reflist}} ==External links== *{{Commons category-inline|Filename extensions}} *[https://fileinfo.com/ Database of filename extensions] at FileInfo.com {{Computer files}} <!-- This makes this page sort in the "C" section of its parent pages and it does not visually make sense {{Authority control}} {{DEFAULTSORT:Computer File Formats}} --> [[Category:Computer file formats| ]] [[Category:Metadata]] [[Category:Computer files]] [[Category:Names]] [[Category:Filename extensions| ]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Citation needed
(
edit
)
Template:Cite book
(
edit
)
Template:Cite web
(
edit
)
Template:Cleanup
(
edit
)
Template:Commons category-inline
(
edit
)
Template:Computer files
(
edit
)
Template:More citations needed
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)