# Binary

Binary (or "base-2") a numeric system that only uses two digits — 0 and 1. Computers operate in binary, meaning they store data and perform calculations using only zeros and ones.

While a single binary digit can be used to represent True (1) or False (0) in boolean logic, multiple binary digits can be used to store large numbers and perform complex functions. In fact, any number can be represented in binary.

Below is a list of several decimal (or "base-10") numbers represented in binary.

Decimal | Binary | Base-2 Calculation |
---|---|---|

0 | 0 | n/a |

1 | 1 | 2^{0} |

2 | 10 | 2^{1} |

3 | 11 | 2^{1} + 2^{0} |

4 | 100 | 2^{2} |

5 | 101 | 2^{2}+ 2^{0} |

6 | 110 | 2^{2} + 2^{0} |

7 | 111 | 2^{2} + 2^{1} + 2^{0} |

8 | 1000 | 2^{3} |

9 | 1001 | 2^{3} + 2^{0} |

10 | 1010 | 2^{3} + 2^{1} |

64 | 1000000 | 2^{6} |

256 | 100000000 | 2^{8} |

1024 | 10000000000 | 2^{10} |

One bit contains a single binary value — either a 0 or a 1. A byte contains eight bits, which means it can have 256 (2^{8}) different values. These values may be used to represent different characters in a text document, the RGB values of a pixel within an image file, or many other types of data.

Large files may contain several thousand bytes (or several megabytes) of binary data. A large application may take up thousands of megabytes of data. No matter how big a file or program is, at its most basic level, it is simply a collection of binary digits that can be read by a computer processor.

**NOTE:** The term "binary" may also be used to describe a compiled software program. Once a program has been compiled, it contains binary data called "machine code" that can be executed by a computer's CPU. In this case, "binary" is used in contrast to the text-based source code files that were used to build the application.

Updated: April 10, 2013