Lably
Skip to content

Binary file

Computer file encoded in binary form

  • 6 min read
  • 6 chapters
  • 1 lab on Lably

Learn it on Lably

Background and terminology

All modern computers store information in the form of bits (binary digits), using binary code. For this reason, all data stored on a computer is, in some sense, "binary". However, one particularly useful and ubiquitous type of data stored on a computer is one in which the bits represent text, by way of a character encoding. Those files are called "text files" and files which are not like that are referred to as "binary files", as a sort of retronym or hypernym.

Some "text files" contain portions that are actually binary data, and many "binary files" contain portions that are encoded text; for instance, textual data may be stored as a field within the binary format, or arbitrary constants may have been chosen to correspond to ASCII letters as a mnemonic (this is common for file magic numbers). These mixed binary-and-text file are usually regarded as "binary", because an application that can only process text will not know what to do with them.

It is quite common for a text file to use its text to encode data that could be encoded in binary some other way; a text file that does this is still regarded as a text file, and not a binary file, so long as it remains within the previously-stated constraints about what the bits of the file represent. For example, in a binary file, the number 250 could be encoded in bits as the sequence 11111010. It could also be encoded in a text file (for example, a programming language source file) as the digits 2, 5, 0; which would in turn be encoded by the bits in the text file as (for example, using UTF-8) 00110010, 00110101, 00110000.

Sign in to keep reading

5 more chapters are free with a Lably account.

More in Computing and communication