Binary is a number system that uses only two digits, 0 and 1. Each digit is a bit. Computers use it because electronic circuits have two reliable states, on and off, which map naturally to 1 and 0.
Base 2 versus base 10
We normally count in base 10, with ten digits and place values that are powers of 10 (1, 10, 100). Binary is base 2: place values are powers of 2 (1, 2, 4, 8, 16). The number 13 is 1 eight, 1 four, 0 twos and 1 one, so it is written 1101.
| Decimal | Binary |
|---|---|
| 0 | 0 |
| 1 | 1 |
| 2 | 10 |
| 3 | 11 |
| 4 | 100 |
| 5 | 101 |
| 6 | 110 |
| 7 | 111 |
| 8 | 1000 |
| 9 | 1001 |
| 10 | 1010 |
Bits and bytes
A bit is one binary digit. A byte is 8 bits and can hold 256 different values (0 to 255). A letter of English text takes one byte.
Why computers use binary
- Two voltage levels are far easier to distinguish reliably than ten.
- Logic (true or false) maps directly to 1 and 0.
- Simple circuits can add, compare and store bits at enormous speed.
How everything becomes bits
- Text: each character has a code. See text to binary.
- Numbers: written in base 2. See decimal to binary.
- Colors, images, sound and video: lists of numbers, which are stored as bits.
Try it yourself: type your name into the text to binary converter.
A short history of binary
Binary ideas are old. The ancient Indian scholar Pingala described binary patterns in verse, and the I Ching uses broken and unbroken lines that map onto 0 and 1. In 1703 Gottfried Leibniz published a complete binary arithmetic. In 1937 Claude Shannon showed that electrical switches could carry out Boolean logic, which is why every modern computer is built on binary.
Binary, decimal and hexadecimal compared
| Base | Digits | Typical use | Example for 181 |
|---|---|---|---|
| Binary (2) | 0, 1 | Hardware, logic, bit flags | 10110101 |
| Decimal (10) | 0 to 9 | Everyday counting | 181 |
| Hexadecimal (16) | 0 to 9, A to F | Compact way to write bytes, colors, addresses | B5 |
Try it yourself
- Write the number 9 in binary using the place values 8, 4, 2, 1 (answer: 1001).
- Convert the letter C to binary with the text to binary converter (answer: 01000011).
- Add 101 and 11 in the binary calculator (answer: 1000).
FAQ
Who invented binary?
Gottfried Leibniz described the modern binary system in 1703, though similar ideas appear earlier in history.
Is binary a language?
It is a number system and an encoding, not a language. What the bits mean depends on the rules used to read them.
How many values can 8 bits store?
2 to the power 8, which is 256.
What is 1000 in binary?
1000 in binary is 8 in decimal; 1000 in decimal is 1111101000 in binary.
