File extension
A filename suffix that indicates the file's type and suggests which application or service can open or process it; varies by operating system, format, and convention.
A file extension (also called a filename extension) is the sequence of characters after the final period in a filename that indicates the file's type. In the string "document.txt" the suffix ".txt" is the extension and commonly signals plain text. Extensions are a human- and system-level convention used to associate files with programs, to help users recognize content, and to provide a simple hint to software about how to interpret a file.
How extensions work and their technical role
Most desktop operating systems use filename extensions as one of the primary cues for deciding which application should open a file. File managers and shells map extensions to default programs and to icons; web servers and applications map extensions to MIME types for transfer and rendering. However, an extension is not a guaranteed indicator of a file's internal structure. Many file formats include a distinct header or "magic number" that more reliably identifies content. Because of this, robust software often checks both the extension and the file body before processing. File systems differ: some are case-insensitive about extensions, while others treat letter case as part of the name.
Common extensions and categories
- Text and markup: .txt for plain text, .htm and .html for web pages; see an example reference .htm/.html.
- Images: .bmp for bitmaps, .jpg or .jpeg for JPEG images and .png for portable network graphics; example image types at image formats.
- Audio and video: .mp3 and .aac for common audio codecs, .flac for lossless audio, and .mp4 or .mkv for container formats; more about media formats here.
- Archives and compression: .zip, .tar, .gz and .bz2 are used widely to bundle or compress files; for archive conventions see archive formats.
- Documents and office files: .doc or .docx for word processing, .xls or .xlsx for spreadsheets, .ppt/.pptx for presentations; a summary resource office formats.
- Code, scripts and executables: .c, .java, .py and similar indicate source code; .class, .exe or platform-specific binaries indicate compiled or executable files. For web server scripts and dynamic pages, see server-side formats.
- Platform-specific types: .dll for Windows libraries, .jar for Java archives and other runtime artifacts; platform notes at platform file types.
- Miscellaneous: many other extensions exist for configuration, data exchange, and proprietary formats; search references at file type lists, format guides and extension references.
Extensions can be single-part (e.g., ".txt") or compound (e.g., ".tar.gz"), where multiple dots indicate a file was archived and then compressed. Historically, early operating systems restricted extensions to three characters, but modern systems allow longer and multiple extensions.
Because extensions are merely naming conventions, they can be changed by renaming a file; this does not convert the file's format. Changing an extension may make a file easier to open by a particular program, but if the underlying bytes do not match the expected format, the program may fail to read the file correctly.
Security and best practices: relying solely on an extension for trust is unsafe. Malicious files can be disguised by misleading extensions (for example, an executable named "invoice.pdf.exe"), and some systems hide known extensions in file managers, increasing confusion. For safety, examine file metadata or signatures, keep software updated, and configure default application associations deliberately. For developers, prefer explicit MIME types and robust content validation rather than trusting filenames alone.
Notable distinctions: different operating systems treat extensions and filenames differently — Windows often uses extensions to select programs, Unix-like systems more commonly use file mode bits and content inspection in addition to names. Case sensitivity may differ by filesystem, and conventions vary across communities (e.g., web, multimedia, programming). Understanding both the social conventions and technical mechanisms behind extensions helps users and administrators manage files reliably and securely.
Related articles
Author
AlegsaOnline.com File extension Leandro Alegsa
URL: https://en.alegsaonline.com/art/34285