Bits and Bytes are explained in the computer network.


The computer network facilitates the transfer of data from one location to another. Internet packs purchased from Mobile Network Operators have a certain amount of data and an expiration date.

If your plan includes one gigabyte (GB) of data daily, you can send and receive one gigabyte (GB) daily.

However, how do you determine how much data is sufficient for you and how much data you may be consuming in a given day? To do so, we must first understand the units of data transfer. In this tutorial, we will discuss the most fundamental units of the computer network, known as bits and bytes.

What is a Bit?

It is the smallest unit of information either stored in a computer memory or transfer over the network. You can think of it as a Boolean flag that can be true or false. Inside a computer, we know them as 0 and 1. 

At the physical level, these are electric signals, zero means low voltage, and one means high voltage.

As per the OSI model, the physical layer converts bits into actual eclectic signals and vice versa. Following are the properties of a bit.

  • It is a Boolean type to represent the smallest unit of data.
  • It can store either 0 or 1.
  • With n number of bits, there can be 2^n possible patterns, for example
    • With number of bits = 1, possible patterns are two(0 and 1).
    • With number of bits = 2, possible patterns are four (00, 01,10, and 11).
    • With number of bits = 3, possible patterns are eight (000, 001, 010,011, 100,101,110, and 111)
  • You can apply bitwise operators on bits e.f XOR etc.
  • Users generally do not bother much about at bit level.

What is a byte?

A byte is the next bigger unit after a bit. A byte is of bits in size. It can represent a total of 256 values. We can compose other units from bytes, such as Kilobytes, Megabytes, Gigabytes, etc.

  • 1 Kilobyte = 1000 Bytes
  • 1 Megabyte =  1000 Kilobytes.
  • 1 Gigabyte = 1000 Megabytes.
  • 1 Terabyte = 1000 Gigabytes.

Computer Programming execution and bits/bytes:

A computer program is a sequence of instructions. During execution, instructions execute one by one. A program may calculate the stored data, e.g., adding two numbers, etc. The values are stored in variables of different sizes. The basic unit of measure is a bit. For example, if we see all data types in programming languages, there are various types.

  • char – One byte and 8 bits.
  • short Two bytes and 16 bits.
  • int – Four bytes and 32 bits.
  • long – Eight bytes and 64 bits.

A programming language provides all binary operators to access and manipulate bits and bytes via a program.