A file format defines the structure and type of data stored in a file. The structure of a typical file may include a header, metadata, saved content, and an end-of-file (EOF) marker. The data stored in the file depends on the purpose of the file format. Some files, such as XML files, are used to store lists of items, while others, such as JPEG image files simply contain a block of data.
A file format also defines whether the data is stored in a plain text or binary format. Plain text files can be opened and viewed in a standard text editor. While text-based files are easy to create, they often use up more space than comparable binary files. They also lack security, since the contents can be easily viewed by dragging the file to a text editor. Binary file formats can be compressed and are well-suited for storing graphics, audio, and video data. If you attempt to view a binary file in a text editor, most of the data will appear garbled and unintelligible, but you may see some header text that identifies the file's contents.
Some file formats are proprietary, while others are universal, or open formats. Proprietary file formats can only be opened by one or more related programs. For example, a compressed StuffIt X (.SITX) archive can only be opened by StuffIt Deluxe or StuffIt Expander. If you try to open a StuffIt X archive with WinZip or another file decompression tool, the file will not be recognized. Conversely, open file formats are publicly available and are recognized by multiple programs. For example, StuffIt Deluxe can also save compressed archives in a standard zipped (.ZIP) format, which can be opened by nearly all decompression utilities.
When software developers create applications that save files, choosing an appropriate file format is important. For some programs, it might make sense to use an open format, which is compatible with other applications. In other cases, using a proprietary format may give the developer a competitive advantage, since the files created with the program can only be opened with the developer's software. However, most people prefer to have multiple software options, so many developers have moved away from proprietary file formats and now use open formats instead. For example, Microsoft Word, which used to save word processing documents in the proprietary .DOC format now saves documents in the open .DOCX format, which is supported by multiple applications.
NOTE: While the term "file format" technically refers to the structure and content of a file, the term is also used interchangeably with "file type," which defines a specific type of file, such as a rich text file or a Photoshop document.