Programming

DECEMBER 1, 2017
by **iamabhishek**

Have you already forgotten the difference between bits and bytes, Kilobits and Kilobytes, Megabits and Megabytes etc, or are still pursuing your computer science education and find this confusing. Do not worry, because all your doubts are about to vanish away and you will never forget it again, most probably. If you do forget, then you can bookmark this link and keep it safe to quickly revise.

In computer network, Bits and Bytes are nothing but standard units of digital data which is transmitted over a network. **1 byte has 8 bits**.

As we know that our modern age computers are nothing but electronic devices which are very good in performing calculations at a very very fast speed. Our computer communicates in digital form, by converting information into bits(short for binary digits), which is nothing but a combination of 0's and 1's. Being electronic in nature, a computer generates bits using the lower and higher voltages running through its circuits which is then converted into 1's and 0's by a Network adapter through a process called as **encoding** to transmit information over a computer network.

A byte is nothing but a collection of 8 bits. As a single bit can either be 0 or 1, hence it is not of much use, as we can only represent two states using a single bit, but when you combine 8 bits together and you can have 256 different arrangements of 0's and 1's thereby making 1 byte more useful, as it can represent a number from 0 to 255 in binary form.

If you are thinking that how are the 256 patterns possible, here is a small representation for you:

Whenever we talk about data being transmitted over a network it is always in bits, but we use bytes to represent file sizes like images, video, textfile etc because representing everything in bits would have been difficult.

Hence, when your Internet service provider says, that the Internet connection provides 8Mbps, it means 8 Megabits per second, which means that you will be able to download 1 MB of data per second. Here **MB stands for Megabyte** and **Mb stands for Megabits**.

It can be confusing, take some time and a few deep breaths and let this sink in.

We all know about IP addresses. An IP address is more like your computer's name/address/identity when it is connected to a network. We all have seen a basic IPv4 address, which is like this - 192.168.0.1 is 4 bytes of data together, joined by dots (.)

As we already learned that 1 byte can hold numbers from 0 to 255, hence the maximum and IPv4 address can be is 255.255.255.255, it will never go beyond this. So if you have a trick question, which says find out the invalid IPv4 address, you know that the one with anything greater than 255, is invalid, because 1 byte cannot hold that.

Talking about bits, 1 byte contains 8 bits, and it is nothing but combinations of 0's and 1's so how does an IPv4 address 192.168.0.1 looks like when represented in bits, here it is:

11000000 10101000 00000000 00000001

MB stands for megabytes and Mb stands for megabits, you must be thinking why we are mentioning this again and again so that you remember it forever. So the next time you have to transfer a file of 10MB, how many bits of data will you be actually transferring? Yes, it will be 80Mb of data.

Similarly, for Internet connections, 8Mbps means 1MB/sec of data getting transferred over the network.

You must be wondering, you know now how to do that. But there is a little trick here too.

- 8 bits = 1 byte
- 1,024 bytes = 1 kilobyte
- 1,024 kilobytes = 1 megabytes

We know 1kilo is 1000, but computers are based on the binary system, where 2 raised to the power 10 is 1024.

Hence, if you have to convert **2 kilobytes** into bits, you will first convert kilobytes into bytes (**2 x 1024 = 2048 bytes**) and then convert the bytes into bits (**2048 x 8 = 16384 bits**)

SHARE YOUR THOUGHTS WITH US!