What Is Binary Code?
Binary is a base-2 number system representing numbers using a pattern of ones and zeroes. Early computer systems had mechanical switches that turned on to represent 1, and turned off to represent 0. By using switches in series, computers could represent numbers using binary code. Modern computers still use binary code in the form of digital ones and zeroes inside the CPU and RAM. Binary numbers consist of a series of eight “bits,” which are known as a “byte.” A bit is a single one or zero that makes up the 8 bit binary number. Using ASCII codes, binary numbers can also be translated into text characters for storing information in computer memory.
How Binary Numbers Work
Converting a binary number into a decimal number is very simple when you consider that computers use a base 2 binary system. The placement of each binary digit determines its decimal value. For an 8-bit binary number, the values are calculated as follows:
Bit 1: 2 to the power of 0 = 1Bit 2: 2 to the power of 1 = 2Bit 3: 2 to the power of 2 = 4Bit 4: 2 to the power of 3 = 8Bit 5: 2 to the power of 4 = 16Bit 6: 2 to the power of 5 = 32Bit 7: 2 to the power of 6 = 64Bit 8: 2 to the power of 7 = 128
By adding together individual values where the bit has a one, you can represent any decimal number from 0 to 255. Much larger numbers can be represented by adding more bits to the system. When computers had 16-bit operating systems, the largest individual number the CPU could calculate was 65,535. 32-bit operating systems could work with individual decimal numbers as large as 2,147,483,647. Modern computer systems with 64-bit architecture have the ability to work with decimal numbers that are impressively large, up to 9,223,372,036,854,775,807!
Representing Information With ASCII
Now that you understand how a computer can use the binary number system to work with decimal numbers, you may wonder how computers use it to store text information. This is accomplished thanks to something called ASCII code. The ASCII table consists of 128 text or special characters that each have an associated decimal value. All ASCII-capable applications (like word processors) can read or store text information to and from computer memory. Some examples of binary numbers converted to ASCII text include:
11011 = 27, which is the ESC key in ASCII110000 = 48, which is 0 in ASCII1000001 = 65, which is A in ASCII1111111 = 127, which is the DEL key in ASCII
Binary Code and Storing Information
All of the documents you write, web pages you view, and even the video games you play are all made possible thanks to the binary number system. Binary code allows computers to manipulate and store all types of information to and from computer memory. Everything computerized, even the computers inside your car or your mobile phone, make use of the binary number system for everything you use it for.