Binary file

A binary file is a file format for digital data that does not necessarily consist of a sequence of printable characters (text). The term is often used for executable machine code.

Description
All digital data, including characters, is actually binary data (unless it uses some (rare) system with more than two discrete levels) but the distinction between binary and text is well established. On modern operating systems, a text file is simply a binary file that happens to contain only printable characters, but some older systems distinguish the two file types, requiring programs to handle them differently.

A common class of binary files includes programs in machine language ("executable files") which are ready to load into memory and execute. Binary files may also be used to store data output by a program which intended to be read by that or another program, but not by humans. Binary files are more efficient for this purpose because the data (e.g. numerical data) does not need to be converted between the binary form used by the CPU and a printable (ASCII) representation. The disadvantage is that it is usually necessary to write special purpose programs to manipulate such files since most general purpose utilities operate on text files. There is also a problem sharing binary numerical data between processors with different endianness.

Some communications protocols handle only text files, e.g. most electronic mail systems before MIME became widespread in about 1995. The FTP utility must be put into "binary" mode in order to copy a binary file since in its default "ASCII" mode translates between the different characters used on the sending and receiving computers.

Confusingly, some word processor files, and Rich Text Format files, are actually binary files because they contain non-printable characters and require special programs to view, edit and print them.