We do many things on our computer systems daily, such as store data, learn programming, browse the internet, download files, etc. However, have you ever wondered what type of data a computer understands and interprets?
It is binary data!
Computers only understand binary data, which includes a sequence of 0s and 1s. Hence, any data you provide to a computer for storing or processing is translated into binary data.
In this blog post, we will understand binary data, its representation, and other aspects in detail.
What is Binary Data?
Binary data is a type of data whose single unit takes one of the two possible values – 0 or 1. It does not take any other value. It is the only category of data computer systems can understand and execute directly.
The binary numeral system or base-2 numeral system is used to represent binary data. In this system, each number is represented using the combination of 0s and 1s with the radix (base) 2.
For instance, in the decimal number system, we represent 15 as (15)10, where 10 is the base and represents the decimal number. In the binary number system, the same 15 is represented as (1111)2, where 2 is the base and indicates the binary representation.
Binary data is used in various technical and scientific fields. In computer science, we refer to the single unit of binary data as a bit , whereas in mathematical logic, we refer to it as the truth value . In statistics, the term binary variable is used widely to represent a single unit of binary data.
How is Binary Data Used in Computers?
Binary data serves as the foundation for computing and digital processing. The reason is computers only understand, interpret, and process data in binary form.
Here is how computer systems use binary data:
-
Binary Representation
Every type of data, including text, images, videos, and audio, is represented in binary format (0s and 1s) in computer systems. Each unit of data is represented as a bit, which takes the value of either 1 or 0.
-
Digital Circuits
A computer system comprises several electronic components, such as transistors, switches, etc. These electronic components have two possible states, ‘on’ or ‘off’ , represented by binary values 1 and 0, respectively.
Computer systems can perform complex computations by properly arranging these electronic components with different states.
-
Storage
We store data in different storage devices, like hard disk drives and solid-state drives . These drives organize our data in files and folders, where each file is a combination of 0s and 1s, representing the data they hold.
-
Processing
The central processing unit ( CPU ) performs the required operations (arithmetic or logical operations) on binary data. Even the instructions we provide to the CPU are represented in the binary code, making it easy to understand and process.
-
Communication
The data exchanged across the network between different devices is in binary form. It is encoded into a format that is easily understood by electronic devices. Generally, the data is exchanged in the form of electrical signals or light pulses through various communication channels, such as optical fibers, cables, etc.
An electrical signal with low voltage is represented by 0 and high voltage by 1. Similarly, the presence of the light pulse is represented by 1 and absence by 0.
-
Computational Decision-Making
Computers leverage binary logic and boolean algebra to make decisions and perform operations. In Boolean algebra, the two states, ‘true’ and ‘false’, are represented by binary values ‘1’ and ‘0’, respectively.
Binary Data Representation
As discussed above, the binary number system represents binary data or numbers. Every smallest unit of binary data is called a bit . A bit can take either of the two binary values – 0 or 1.
Multiple bits combine together to represent a larger unit of data. A combination of 8 bits forms 1 byte, which is the fundamental building block to represent data in computers. Multiple bytes are used to store different types of data, such as characters, integers, symbols, etc.
The following table represents different types of data and their storage requirements in terms of bytes and bits:
Data Types |
Bytes/Bits |
Integer |
4 Bytes/32 bits |
Character |
1 Byte/8 bits |
Float |
4 Bytes/32 bits |
Double |
8 Bytes/64 bits |
Short |
2 Bytes/16 bits |
Long |
8 Bytes/64 bits |
Boolean |
1 Byte/8 bits |
Binary vs Decimal
Binary numbers use the base-2 numeral system for data representation, whereas decimal numbers use the base-10 numeral system. Each binary digit can take two possible values, ‘0’ and ‘1’. On the other hand, each decimal digit can take values ranging from 0 to 9.
Decimal Number Representation
In the decimal number system, each digit represents a power of 10. For instance, consider the number 234. The rightmost digit ‘4’ in the number is considered the unit place. The digit left to it, ‘3’, is considered the 10th place value, the further left digit, ‘2’, represents the 100th place value, and so on.
Hence, we represent 234 in the decimal number system as
[(2*102) + (3*101) + (4* 100)] = [(2*100) + (3*10) + (4*1)] = 234
Now, consider the 4-digit number 3452. The following table shows the places occupied by each digit:
Digit |
3 |
4 |
5 |
2 |
Places |
1000th place (10^3) |
100th place (10^2) |
10th place (10^1) |
1st place (10^0) |
Decimal to Binary Conversion
Every decimal number has its equivalent binary number, which is used by computer systems and electronic devices. For instance, (2)10 in binary is represented as (10)2.
In any binary number, the leftmost digit is the most significant bit (MSB), and the rightmost digit is the least significant bit (LSB).
The most common method to convert a decimal number to binary is the Formula Division Method . Here are the steps for the method:
- Divide the given decimal number by ‘2’. If the number is even, the remainder will be 0; otherwise, it will be 1.
- When you divide a number, store its reminder aside and use the result for the subsequent division by 2.
- Continue dividing the results by 2 until you get the result 0.
- Collect all reminders from bottom to up.
We shall understand this using an example.
Consider a decimal number - 100. We will use the above steps to generate its binary equivalent.
Decimal Number |
Result |
Remainder |
100 |
(100/2) = 50 |
0 (LSB) |
50 |
(50/2) = 25 |
0 |
25 |
(25/2) = 12 |
1 |
12 |
(12/2) = 6 |
0 |
6 |
(6/2) = 3 |
0 |
3 |
(3/2) = 1 |
1 |
1 |
(1/2) = 0 |
1 (MSB) |
Now, collect all reminders from bottom to top, which is equal to (1100100)2.
Hence, (100)10 = (1100100)2.
Here, 0 on the left is the most significant bit (MSB), and 1 on the right is the least significant bit (LSB).
Binary to Decimal Conversion
Let us now understand how to convert a binary number to its decimal equivalent.
In the above conversion, we have used the division formula. Here, we need the multiplication method.
Here are the steps for binary to decimal conversion:
- Write a binary number and allocate the powers of 2 starting from 0 from the left side.
- Now, multiply each binary digital with its corresponding power of 2.
- Add the products of all multiplication operations.
- The resulting number is the decimal number.
Let us understand this with an example.
Consider the binary number (1100100)2.
1 |
1 |
0 |
0 |
1 |
0 |
0 |
26 |
25 |
24 |
23 |
22 |
21 |
20 |
(1*26) |
(1*25) |
(0*24) |
(0*23) |
(1*22) |
(0*21) |
(0*20) |
64 |
32 |
0 |
0 |
4 |
0 |
0 |
Now, add the products = (64+32+0+0+4+0+0) = 100
Hence, (1100100)2 = (100)10.
Decimal to Binary Table
Here are the decimal numbers and their binary equivalents
Decimal Numbers |
Binary Equivalents |
0 |
0 |
1 |
1 |
2 |
10 |
3 |
11 |
4 |
110 |
5 |
101 |
6 |
110 |
7 |
111 |
8 |
1000 |
9 |
1001 |
Binary Numbers to Text Conversion
Binary numbers are converted into text using the character encoding standard, American Standard Code for Information Interchange (ASCII). ASCII code represents text in computers, electronic devices, and telecommunication equipment.
There are 128 ASCII codes that represent uppercase [A...Z] and lowercase [a…z] alphabets, numbers from 0 to 9, and special symbols. Each text or character has an associated decimal value. Using the decimal value, it is possible to convert it into its binary equivalent.
The following table highlights the ASCII codes of some significant characters and symbols:
ASCII Code |
Text |
Binary Representation |
65 |
A |
01000001 |
66 |
B |
01000010 |
67 |
C |
01000011 |
68 |
D |
01000100 |
69 |
E |
01000101 |
70 |
F |
01000110 |
71 |
G |
01000111 |
72 |
H |
01001000 |
73 |
I |
01001001 |
74 |
J |
01001010 |
75 |
K |
01001011 |
76 |
L |
01001100 |
77 |
M |
01001101 |
78 |
N |
01001110 |
79 |
O |
01001111 |
80 |
P |
01010000 |
81 |
Q |
01010001 |
82 |
R |
01010010 |
83 |
S |
01010011 |
84 |
T |
01010100 |
85 |
U |
01010101 |
86 |
V |
01010110 |
87 |
W |
01010111 |
88 |
X |
01011000 |
89 |
Y |
01011001 |
90 |
Z |
01011010 |
91 |
[ |
01011011 |
92 |
\ |
01011100 |
93 |
] |
01011101 |
94 |
^ |
01011110 |
95 |
_ |
01011111 |
96 |
` |
01100000 |
97 |
a |
01100001 |
98 |
b |
01100010 |
99 |
c |
01100011 |
100 |
d |
01100100 |
101 |
e |
01100101 |
102 |
f |
01100110 |
103 |
g |
01100111 |
104 |
h |
01101000 |
105 |
i |
01101001 |
106 |
j |
01101010 |
107 |
k |
01101011 |
108 |
l |
01101100 |
109 |
m |
01101101 |
110 |
n |
01101110 |
111 |
o |
01101111 |
112 |
p |
01110000 |
113 |
q |
01110001 |
114 |
r |
01110010 |
115 |
s |
01110011 |
116 |
t |
01110100 |
117 |
u |
01110101 |
118 |
v |
01110110 |
119 |
w |
01110111 |
120 |
x |
01111000 |
121 |
y |
01111001 |
122 |
z |
01111010 |
Conclusion
In the end, the entire data we store on computers or other devices is in the form of 0s and 1s, which is meaningless for humans. Binary data serves as the foundational language for computers, as they store every type of data in the combinations of 0s and 1s. Without binary data, it would be impossible to interact with computers.
Hence, understanding binary data and its conversion into different forms is essential.
We hope this article has made it clear to you about binary data. If you have any queries, let us know in the comments.
People are also reading:
Leave a Comment on this Post