Want to learn how how binary code works and how computers use it to store and process data? Keep reading! The basics of binary are within your reach!
Without communication, we’d be nowhere, and we would have no way to talk or share coherently. The same is true for computers, except they don’t communicate with traditional language, as we do.
Computers have a limited vocabulary, composed of a language called binary code. Instead of letters, the computer alphabet — if you can call it that — is made up of 1’s and 0’s. When compiled together, they create a complex language that only computers can understand. Well, that’s not entirely true, we can understand binary code too if we invest the time to learn it!
What Is Binary Code?
The concept of binary code is quite simple. Every 0 means off or disabled, and every 1 means on or enabled. In other words, you can look at them as a switch or lever. If you’re looking at binary code and you see a 1, then you know that particular data point is “on,” or has been initiated. The opposite is true when you see a 0 in the code.
While that’s a rudimentary definition of binary code, it will certainly help you understand the language much better.
To quantify how that kind of code can tell a computer what to do, or communicate rather, you must consider how these machines handle the information.
Not necessarily in this order, computers will:
- Receive inputs or commands from users through applications
- Collect, store, and process data as information
- Deliver output in the form of stored or processed data
Let’s break that down even more. While coding, for example, you interact with your keyboard to input commands. That is essentially telling your computer what it needs to know, by providing it “inputs” it can process. It takes that information and stores it. When you compile and run your code it retrieves the data and begins processing as it’s supposed to. Then it delivers an output, usually, through action, which would be whatever your code was telling it to do.
Except, instead of leveraging programming languages — as you know them — the computer is working with a complex series of 1’s and 0’s that it can understand.
What Does That Have to Do with Programming?
There’s one big problem, here. When we communicate with computers through programming languages, we are not using 1’s and 0’s, so how do the two relate?
That’s because binary code is the fundamental or core language that computers use to process and read data. And it would be too difficult for us to work with, at least as-is. Instead, we use another form of communication, or language, called programming languages. These languages — of which there are many — translate information into binary so that the computers can interpret the data and make use of it.
When you learn to code, really you’re learning to speak to computers in a language they can understand. So, even though you may not be using binary directly, it’s still important that you know what it is and how it works.
What Happens with the Binary 1’s and 0’s?
The numbers or 1’s and 0’s are how computers read, process, and store data. It’s a leftover mechanism from old-school computers which used to have indicators, like switches, telling their handlers whether a storage point was enabled or disabled. Old computers, which were incredibly large, used to have lights, and when the lights were on it meant a 1, and when they were off it meant a 0.
Today’s computers are much more advanced and complex, and those 1’s and 0’s can represent any symbol, letter, number, or segment of data. Binary just happens to be how the computers process the information.
They can represent many things, such as:
- True or false
- On or off
- Yes or no
- Enabled or disabled
- Initiated or uninitiated (at-rest)
You get the idea.
How to Store Data Using Bits
Within each of those “switches” is a bit of data. So, if you have five switches you would have the option to store five bits of data. If you had ten switches, then ten bits of data, and so forth.
To understand how information is stored in today’s computers, we need to look at the hardware inside. It’s the hardware that truly retains the more complex information, while the computer itself deals in 1’s and 0’s.
Every time you store data, inside the computer that information is stored in something called a capacitor, using electrons. This type of system is what makes up a memory module, or DRAM. Boiled down to basics, these capacitors are essentially the same as the switches, but they can hold more information, or rather more nuanced details.
Today’s computers get most of their data storage and processing power because of how capable DRAM or advanced capacitors are. Let’s say your computer has 4GB of DRAM, which is the base capacity of most computers on the market today.
Each GB (Gigabyte) contains a billion bytes or 230 bytes. For every 1 byte, there are 8 bits. To calculate how many bits there are, or switches, we need to use a little math.
230 (bytes) x 4 (GB) x 8 (bits) = 34,359,738,368 bits
So, that means there are 34 billion switches in 4GB of RAM. Now imagine higher capacities of RAM like 8GB, 16GB, or even 64GB! The same is true for massive hard drives at 1TB or beyond! Any one of those bits, or switches, can be used to store information. That’s a lot of room to store data.
That is precisely how computers use binary to store long strings of information. The long strings of 1’s and 0’s can be used to denote particular letters, numbers, and symbols. This is called binary code, while reading it is called “decoding.”
That’s all good to know, but it doesn’t answer an important question. What is binary? How does it work and how do computers use it?
How Does Binary Code Work?
Because the storage strings are so long, computers can use what’s called a binary number system to store and read data.
The standard form of numerics relies on the decimal number system, starting at 0 and it goes up to 9. This is the most basic representation, which we all learn in school. Computers don’t use this, however, at least not in its direct form.
Also referred to as the base-ten numeral system, in the decimal system, as the digits grow — beyond the 10’s, 100’s, 1000’s, etc. — we increase by powers of 10, expanding more and more.
Binary works in a similar way, except it relies on powers of 2, not 10. So, a computer uses longer strings of binary which correspond with digits beyond 1’s and 0’s.
- The first digit is 20, which represents the 1’s
- The second digit is 21, which represents the 4’s
- The third digit is 22, which represents the 8’s
- The fourth digit is 23, which represents the 16’s
- The fifth digit is 24, which represents the 32’s
- Etc.
This results in long sequences of 1’s and 0’s, like 111010110.
For storing content like text, those strings are used to denote letters. A number 1 would be “A,” the number 2 would be “B,” and so on.
For images and other content, binary is used the same way. This is why images and photos are displayed in pixels. Every pixel has a numerical value associated with it, which tells the computer what colors to display.
Ultimately, the massive number of switches, or capacitors, is what makes it possible to work with computers using binary code. The binary is translated into more practical information, before being output to us.
Welcome to the Basics of Binary
There you have it! Now you have a basic understanding of binary code, how it works, and how computers use the language to translate and work with information.
If you would like to continue learning, we have many resources to help you dive into more advanced lessons.
Disclosure of Material Connection: Some of the links in the post above are “affiliate links.” This means if you click on the link and purchase the item, I will receive an affiliate commission. Regardless, I only recommend products or services I use personally and believe will add value to my readers.