Binary may refer to any of the following:
- Binary is a base-2 number system invented by Gottfried Leibniz that’s made up of only two numbers or digits: 0 (zero) and 1 (one). This numbering system is the basis for all binary code, which is used to write digital data such as the computer processor instructions used every day.
How does binary work?
The 0s and 1s in binary represent OFF or ON, respectively. In a transistor, a “0” represents no flow of electricity, and “1” represents electricity being allowed to flow. In this way, numbers are represented physically inside the computing device, permitting calculations. This concept is further explained in our section on how to read binary numbers.
- How does binary work?
- Why do computers use binary?
- How to read binary numbers.
- How to add in binary.
- What are a left shift and right shift?
- What is the “0b” prefix?
- Binary humor.
- Convert text into binary
- Related information.
Why do computers use binary?
Binary is still the primary language for computers and used with electronics and computer hardware for the following reasons.
- It is a simple and elegant design.
- Binary’s 0 and 1 method is quick to detect an electrical signal’s off (false) or on (true) state.
- Having only two states placed far apart in an electrical signal makes it less susceptible to electrical interference.
- The positive and negative poles of magnetic media are quickly translated to binary.
- Binary is the most efficient way to control logic circuits.
How to read binary numbers
The following chart illustrates the binary number 01101000. Each column represents the number two raised to an exponent, with that exponent’s value increasing by one as you move through each of the eight positions. To get the total of this example, read the chart from right to left and add each column’s value to the previous column: (8+32+64) = 104. As you can see, we do not count the bits with a 0 because they’re “turned off.”
The next example is 11111111 in binary, the maximum 8-bit value of 255. Again, reading right to left we have 1 + 2 + 4 + 8 + 16 + 32 + 64 + 128 = 255.
When you have eight bits, it is equal to one byte. If you took the binary code from the first example (01101000), which totaled “104,” and put it into ASCII, it would produce a lowercase “h.” To spell the word “hi,” you would need to add the binary for the letter “i,” which is 01101001. Putting these two codes together, we have 0110100001101001 or 104 and 105, which represents “hi.” Further information on the binary-to-ASCII conversion is found on the following link.
Counting on a computer normally starts at “0” instead of “1.” Therefore, counting all the bits does equal 255, but if you start at 0, it’s 256.
- How does a computer convert text into binary or 0’s and 1’s?
How to add in binary
Adding in binary works a lot like adding in decimal. For example, if we had the binary 01101011 (107) and wanted to add 10000111 (135), we’d follow the following steps.
Starting from the right side, we’d add 1+1 to get “2.” Because there’s no number two in binary, we’d use the binary value “10” and carry the “1” to the next column.
In the next column, we’d add the “1” we carried over to the next column and add 1+1+1 to get “3.” There is no number “3” in binary, so we use “11” (3 in binary) and put 1 and carry the 1 to the next column.
Next, we’d add the “1” again that was carried over and add 1+0+1 to get “10” (2 in binary).
We repeat this same process for all eight digits to get the following result of 11110010 (242).
What are a left shift and right shift?
A left shift is when each bit in the binary number is shifted (moved) to the left to double the binary value or multiplied by two. For example, the binary number “00000011” equals three, and when left-shifted, it becomes “00000110,” which is equal to six. As another example, the binary number “00111110” equals 62, and shifting the bits to the left makes “01111100” or 124.
A right shift is like a left shift, except the bits are shifted to the right to divide the number by two. For example, the binary number “00001010” equals ten, and when right shifted, it becomes “00000101” or five.
What is the “0b” prefix?
To help prevent confusion, when writing a binary number, it may have a “0b” (zero and b) prefix. For example, 0b0100 represents “0100” in binary. By using this prefix, the reader knows this is not “100” in decimal.
Binary humor
The image is an example of some binary humor (joke) via a famous saying on many geek t-shirts. Those who can read binary realize this quote actually says, “There are only two types of people in the world: Those who understand binary and those who don’t.” In the binary system, 10 is two, not number ten.
Convert text into binary
The following tool converts any text into binary.
- While in an FTP session, binary is a command that switches the file transfer mode to binary. For information about binary and other FTP commands, see: How to use FTP from a command line.
Related information
- How does a computer convert text into binary or 0’s and 1’s?
- How does a computer process data into information?
- Additional information and examples of binary and hexadecimal conversions.
- When used as a noun, the term “binary” may refer to an executable file. For example, “locate the binary named program.exe, and double-click it.”
Base, BCD, .BIN, Binary file, Bit, Decimal, Hexadecimal, Least significant bit, Machine language, Most significant bit, Native language, Negation, Nibble, Octal, OFF, ON, Qubit, Software terms, Ternary, Two’s complement