Understanding Binary, The Language of Digital Systems
Understanding binary helps us speak the language of digital devices, making it easier to see how they process information.
Learning binary can help you grasp how computers ‘think’ and why they rely on this unique system to operate. In this article, we’ll break down the basics of binary and explore why it’s the backbone of digital technology.
Introduction
Essentially, binary, also known as base-2 in mathematics, is a way to represent numbers using only 2 symbols, typically 0 and 1.
The system we use in everyday life, for instance, is based on base-10 (or decimal).
Unless you are writing strictly in Chinese or Japanese and using the old characters like 二,四,六,八,十 etc., you are probably using the digits 0 through 9: 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9.
This gives decimal a more compact look as we’ll see in a moment, but in certain applications, like computers, it is more practical to use binary.
The use of binary is fundamental to computing for the simple fact that it is difficult to distinguish between the tiny changes in electrical behavior.
Analog systems like AM radio made minuscule changes to electrical properties like the exact power they put out or the precise voltage they used, which the receiver would pick up on and decode into audio waves.
The problem was that it was incredibly hard to stop interference from changing your measurements when trying to decode those signals afterwards.
This is why digital systems, for the most part, only use electricity in two states: it’s either on (1) or off (0).
While not as short as analog signals, two singular states are so much more resilient against interference that they end up being more efficient for transmitting data.
Thus, we needed to use a base to represent the possible states that a circuit could be in at one time, and if there are only 2 states, we went with binary.
The Basics of Binary
Say we have a number, 123.
In the decimal system, every digit you take from right to left represents 10x the amount of stuff as the preceding digit.
In school, we are taught that 123 can also be represented as (1 x 100) + (2 x 10) + (3 x 1), or 100 + 20 + 3.
So, in base-10, each place represents a power of 10; in binary, it’s a power of 2. This fundamental change is why we need binary to communicate in terms of ‘on’ or ‘off’ states.
So, to represent 123, we would write 01111011 or (0 x 128) + (1 x 64) + (1 x 32) + (1 x 16) + (1 x 8) + (0 x 4) + (1 x 2) + (1 x 1). This simplifies to 0 + 64 + 32 + 16 + 8 + 0 + 2 + 1 which gives, finally 123 (in decimal).
Although this seems less compact, binary’s simplicity makes it far more resilient to interference, which is essential in digital communication.
Before we go on
Let me introduce two simple terms: What is a bit, and what is a byte?
A bit is the smallest unit of data in binary, representing a single value — either 0 (off) or 1 (on).
A collection of 8 bits is called a byte, which offers 256 unique combinations (2⁸) and allows computers to represent larger data values.
Remember that 256 as the number of possible values also includes 0, so if we’re talking about encoding numbers, binary can encode whole numbers between 0 and 255.
How Binary Represents Information
I’ve already touched on how you can use binary to convert a decimal number into binary, but binary can also be used to encode text!
For the purposes of this article and for clarity, I will not delve into the creation of ASCII or Unicode here.
With that being said, here is how you can represent an ASCII character in binary as an example.
First, pick one! Here’s a list: https://www.ascii-code.com/
That list will give you all characters adopted into the ASCII standard. Now, let’s take ‘A’ as an example. Uppercase ‘A’, in ASCII, has the code 65 in decimal. Now, let’s convert it into byte-form.
Now, think of the number 65. Does 128 fit in? If not, then write down a 0, and move to the next digit.
Does 64 fit into 65? If so, write down a 1, and subtract 64 from your total of 65, so you remain with 1.
Does 32 fit in 1? No, so write a 0.
Does 16 fit in 1? No, so write a 0.
Repeat this until the last step. By now you should have the sequence 0100000.
Does 1 fit in 1? Yes! So write a 1.
By the end, you have the sequence 01000001, the binary form of decimal 65.
Quick Tip
I highly recommend when you are just starting to work with binary that you make a table with two rows and 8 columns.
On the first row, from right to left, do this:
- Write 1 in the right-most column, then, for the next column, double that, so 2. Then, double that again to 4, and repeat this process until you have the entire row filled. It should go from 1 to 128.
- The entire progression is 1, 2, 4, 8, 16, 32, 64, 128, all of which can be represented as different powers of 2. 1 is 2⁰, 2 is 2¹, 4 is 2² and so on.
You can also extend the table for however many digits you want. I simply chose 8 because I wanted to represent a byte.
Then, when you want to convert a less-than-256 decimal number into binary, just go through the list above, as it makes things easier to visualize.
Also, just so it’s crystal clear: by ‘fit in’ I am specifically referring to whole numbers.
From left to right this time, let’s pick 245 as an example.
Does 128 fit into 245? Yes! So write a 1, and 245–128=117
Does 64 fit into 117? Yes! So write a 1, and 117–64=53
Does 32 fit into 53? Yes! So write a 1, and 53–32=21
Does 16 fit into 21? Yes! So write a 1, and 21–16=5
Does 8 fit into 5? No! So write a 0 and leave 5 intact
Does 4 fit into 5? Yes! So write a 1, and 5–4=1
Does 2 fit into 1? No! So write a 0 and leave 1 intact
Does 1 fit into 1? Absolutely! So finally, write a 1.
Now you just put all the numbers in series and voila! 11110101 is the byte that represents the number 245.
By making this table, you can quickly see which binary positions are necessary to represent your number.
Why Binary?
In short, we use binary because when dealing with signals, it’s much harder to interpret small changes accurately compared to a clear ‘on’ or ‘off’ state.
Binary’s use of distinct states avoids misinterpretation caused by subtle electrical changes, which is common with analog signals.
Real-World Applications
Every day, millions of computers, smartphones, solar-powered calculators and any other digital devices rely on binary to process and deliver information accurately.
From unlocking your phone and browsing online to withdrawing cash at an ATM and checking your bank account, binary is at the core of every digital process.
Conclusion
So, to recap:
- Binary is a base system in which two symbols — 0 and 1 — are used to convey the value of numbers.
- Decimal is the base system most commonly used by humans, using 10 different symbols to convey the value of numbers.
- Each additional digit in a binary number, from right to left, represents 2x the value of the digit before it.
- Each additional digit in a decimal number, from right to left, represents 10x the value of the digit before it.
- Binary is mainly used by electronics enthusiasts to represent the state of a circuit.
- Software engineers also use it when talking with lower level hardware directly or, in some instances, when interfacing with certain programs.
If you enjoyed my explanation and like learning about these more obscure things, feel free to leave me a comment on what you would like to see next!
Below are some of the resources I used in compiling this tutorial. Look around, you might find something interesting!
Further Reading
- ASCII Table: Quick warning that this site is owned by a Swedish firm (Injosoft), not IANA (Internet Assigned Numbers Authority). If you want to explore ASCII codes on your own, here’s a list of ASCII characters.
- ASCII and Unicode Wikipedia: These were both a pretty good read, although they didn’t make the cut into the article.
- Floating Point Number Representation in Binary: I highly recommend this article if you want to learn how floating-point numbers get represented in binary, as I wasn’t able to delve into specifics here.
- Powers of 2 table: The trick that helped me with remembering the position of bits in a byte by using that table came from a NetworkChuck video I watched a while back.
Some AI assistance was used to streamline the structure and clarify technical language.