Binary encoding is a type of code used primarily to program computers at the most basic level. It consists of a system of ones and zeros, designed to represent either a "true" or a "false" value in logical operations. Binary encoding was developed by Claude Shannan in the 1930s using switches.
Binary is raw data that almost all computers use, but most computer users do not interact with it directly. The computer reads the binary code and translates it into data useful for the user. Codes are stored in different ways depending on the type of object. For example, codes can be stored by voltage, simply denoting whether an object is on, or has voltage, or is off. CD-ROMs use dark spots on a shiny surface to denote "true" or "false" values, hard disks use magnetism, and memory uses electric charge.
Binary encoding relies on bits, the smallest unit of encoding. Similar to a switch that can either be off or on, a bit can have a value of either one or zero. More familiar processing units are derived from the bit. A byte is eight bits, a kilobyte has 1,000 bytes, and a megabyte has 1,000 kilobytes. The greater the number of bits, the more combinations the bits can be in, so the more information can be stored.
For example, two bits have four states. Both can be off, both can be on, or one can be off and one can be on. In binary, these combinations are written as 00, 01, 10, 11. The number of states of a group of bits can be found by the expression 2n, where n is the number of bits.
Since there are only two values for each bit, they are simpler to work with than other computer encoding processes. Groups of bits are used to represent different information. A byte often represents an alphabetic character. For example, the letter "A" written in binary is "01000001."
A hard disk in a modern computer may hold 150 million characters. Operating systems use around 100 megabytes of those characters. Files also use binary encoding, .exe and .gif files particularly store their data in binary code. The data is transmitted over the Internet or stored on drives in binary and then decoded by the computer into usable information.
Though most often used to program computers, binary encoding is also used in genetic algorithms in order to determine crossovers in heredity between parents and offspring. Bits are assigned to each parent to represent a piece of their genetic code. Then random or specific bits are copied over or inverted to produce the offspring's code.