What is a bit ?
A bit is the smallest unit of data in computing.
In simple terms:
A bit can have only two values:
0 or 1
These represent off/on, false/true, no/yes
Why only 0 and 1?
Computers work using electricity:
No current → 0
Current present → 1
This makes bits very reliable for machines.
Example:
1 bit → can store one decision (yes or no)
8 bits = 1 byte
Example: 01000001 = letter A
Real-world analogy:
Think of a light switch:
OFF → 0
ON → 1
That switch is like a bit.
Bigger units built from bits:
8 bits = 1 byte
1024 bytes = 1 KB
1024 KB = 1 MB
And what is a byte then ?
A byte is a group of bits.
Simple definition:
1 byte = 8 bits
It is the basic unit used to store data
Why 8 bits?
With 8 bits, a byte can represent:
256 different values (0–255)
Enough to store:
A letter (A, b)
A number
A symbol (@, #)
Example:
Letter A → 01000001 (8 bits = 1 byte)
Digit 5 → stored as a byte
A small image pixel color value → stored in bytes
Real-world analogy:
If a bit is a single switch,
a byte is a row of 8 switches working together.
Common data sizes:
1 byte → one character (a)
1024 bytes → 1 KB
1024 KB → 1 MB
1024 MB → 1 GB
Why bytes matter:
File sizes are measured in bytes
Memory (RAM) is organized in bytes
Storage (SSD, HDD) is counted in bytes
A byte is made of 8 bits and is used to store a single piece of meaningful data, like a character.
Addressing -
It is of 2 types -
1 - physical addressing
2 - logical addressing
Imagine a hotel 🏨
Room number → Logical address
Actual location of the room in the building → Physical address
You tell the receptionist the room number.
The hotel system maps it to the actual room location.
You never see the physical location directly.
Logical Address
Physical Address
Used by program
Used by RAM
Virtual
Real
Safe
Hardware-level
Program uses logical address, computer uses physical address
*Physical addressing - under physical addressing there comes - “ Mac addressing “
Mac Addressing -
Permanent address of a network device
Given by the manufacturer
Works at hardware level
Used inside the local network
Uses— Identifies a specific network device
Used for communication inside a local network (LAN)
Helps switches deliver data to the correct device
MAC address is never used on the internet
It works only inside the local network
Key Points:
Cannot be changed easily
Unique for every device
Works at Layer 2 (Data Link Layer)
*Logical Addressing - under logical addressing comes - “ IP addressing”
IP Address
Assigned by network or ISP
Can change (Wi-Fi, mobile data, DHCP)
Used to identify device across networks
Works at software level
Key Points:
Can change anytime
Not tied to hardware
Works at Layer 3 (Network Layer)
*Uses -
Identifies a device on a network or the internet
Helps data travel between different networks
Used by routers to decide where to send data
Real-life use:
When you open Google.com, your IP helps:
Find Google’s server
Route data across the internet
Without IP addressing, internet communication is impossible
IP Address is made of two things -
= Network ID + Host ID
*Important Addressing that comes under physical addressing -
Mac addressing - it is of “48 bits”
*In logical addressing comes -
IP V4
IP V6
In these IP comes 2 types of IP’s -
Public IP
Private IP
*IP V4 -
Full form - Internet protocol
IP is the thing through which you send send message from place to another.
It is a 32 bit logical address
It have 4 octet
It have values ranging from and between - ( 0 - 255 ) in every octet
IP address is made of 2 things - ( Network ID + Host ID )
IP is always written in 4 octets -
Each octet is made up of 8 Bits
Maximum value in a IP is 255 , minimum is 0
*IP Addresses have 5 classes -
Classes -
Class A - 1.000 to 126.000
Class B - 128.000 to 191.255.00
Class C - 192.000 to 223.255.255.00
Class D - 224.000 to 239
Class E - 240 - 255
( “IP 127.000” is reserved for special purpose - “ Loop back address”
( If you are unable to use internet or there is an issue with internet then using this you can see if the issue is “hardware level or software level”
( like when you type ping 127.0.0.1 and if you get response then the issue might be software level ( internet not being received from backend ) ( and if you didn’t receive a response there might be some hardware issue like in network card of PC )
The loopback address is a special IP address used by a device to communicate with itself.
127.0.0.0 – 127.255.255.255
This entire block is reserved for loopback.
What Does It Do?
When you send traffic to 127.0.0.1, the data:
Does NOT go to the network
Does NOT leave your machine
Is routed internally by your OS
It is used to test the TCP/IP stack.
ping 127.0.0.1
If this works:
Your network stack is functioning
TCP/IP is properly installed
If it fails:
There is a serious OS-level networking issue
Where It Is Used
Testing web servers locally
Example:
Database servers running locally
Application development
Troubleshooting networking
It is a old concept when and people never thought we might run into a IP shortage in future
*Genrally we don’t use - Class D and Class E as they are reserved -
Class D - for Multi cast / special work
Class E - For Research
*We use class A , B , C -
Class A - is called a “ Large network” ( If you want to make a large network and give out more IP’s )
Class B -
Class C - is called a “small network” ( If you want to make a small network and allocate / give out fewer IP’s )
We generally don’t work on public IP , we think we are working on public but in the end it’s a private IP we too have borrowed from a firm or anything anyone.
*What if someone asks a particular IP address class -
Example - 137.20.20.10 ( tell the class of this IP address )
Nothing to do when telling a IP address class just look at the “first octet”
Here it is - “137” and it lies in “class B” so this is the class if this IP address.
*What if someone asks what is the “network ID” of a IP address?
Simple way to learn -
Just remember this -
Class A - have 1 Network octet reserved and rest 3 are reserved for host ID
N
H
H
H
Class B - Have 2 network octet reserved for network ID and 2 reserved for host ID
N
N
H
H
Class C - Have 3 network octet reserved for network ID and 1 reserved for host ID
N
N
N
H
N = Network , H = Host
Network ID is denoted by - “ 1” and Host ID is denoted by - “ 0 “
N = 1
H = 0
Example - Tell network ID of this IP Address -
115.20.15.240
Answer - first look in which class does is fall -
It falls in Class A - class A have 1 Network octet reserved and 3 Host octet
Final Answer = 115.0.0.0 - network ID
( The value on which 1 comes write that and write the rest as 0 )
Example 2 - find network of this - 140.20.15.10
( this falls under class B )
Answer - 140 20.0.0 - network ID
*What if someone asks tell the subnet mask of a particular IP given?
Example - 115.20.30.20
As mentioned above Network ID and Host ID is represented by 1 and 0 ( N - 1 , H = 0 )
115.20.30.20 - This falls in Class A
N
H
H
H
( N = 1 , H = 0 )
11111111.00000000.00000000.00000000 ( binary value )
Subnet mask will be ( decimal value ) - 255.0.0.0
( 8 TIMES 1 because 1 octet have 8 bits , and the value on which 1 comes we have to write that and here that value is 115 )
Example 2 - 193.50.15.20
Tell the subnet mask of this IP address -
Answer = this falls under Class C
N
N
N
H
Binary value - 11111111.11111111.11111111.00000000
Subnet mask - 255.255.255.0
*Convert a IP address into binary?
Example - 192.168.37.200
We know that each have 8 bits - maximum value of a bit is 255
2 power 0 = 1
2 power 1 = 2
2 power 3 = 8
2 power 4 = 16
2 power 5 = 32
2 power 6 = 64
2 power 7 = 128
Just write this value this question is aksed or even vice a versa
Don’t write more than 128
Now we want to make 192 - just add the values which will make 192 ( all combined values from 1 - 128 will make 255 , and whatever you add using these the answer will come to 255 or less so for converting to binary you just need these values ( 1 to 128 )
Now 192 =
(128 64 32 16 8 4 2 1)
192 = 128 + 64
So , as said the numbers which are used in addition or we say used to make that particular number we will mark them as 1 and others rest as 0
In here number 128 and 64 were used to make 192 ,
The binary og 192 will be - 11000000 - 192
128
64
32
16
8
4
2
1
1
1
0
0
0
0
0
0
Now the next number is 168 -
128
64
32
16
8
4
2
1
1
0
1
0
1
0
0
0
The next - 37
128
64
32
16
8
4
2
1
0
0
1
0
0
1
0
1
The next is - 200
128
64
32
16
8
4
2
1
1
1
0
0
1
0
0
0
So the binary value of 192.168.37.200 is =
11000000.10101000.00100101.11001000 - Binary
And vice a versa is also possible with this -
If the ask is to convert a binary into decimal then same method is used
*Private IP
A private IP address is an IP address used inside a local network and not routable on the public internet.( schools , colleges etc )
These addresses are reserved and cannot be used directly on the internet.
In Class A the Private IP reserved is - 10.0.0.0
Very large private network
Often used in enterprises and cloud networks
In Class B the private IP reserved is - 172.16.0.0 – 172.31.255.255
Used in medium sized private network
In Class C the private IP reserved is - 192.168.0.0
Used in homes and small offices
*public IP and Private IP difference -
You have to purchase the Public IP whereas you don’t have to purchase a private IP.
*How to know how many computers you can connect in 1 IP and what is a broadcast IP and Usable host -
Example - ques - 150.10.20.30
Tell network ID
Tell Broadcast ID
No of Usable Host
Network ID = ( As this is from class B ) - 150.10.0.0
Broadcast - A broadcast address is a special IP address used to send data to all devices inside a network at once.
Broadcast ID - as we saw above the network ID of the IP is 150.10.0.0
Just remember the host part which you marked as 0 above or in any class IP , just assign that 0 the maximum value of a bit that is - 255
So the broadcast ID = 150.10.255.255
Now the question remains how many usable hosts ( computers ) i can put make allocate in this network
See in the above broadcast ID we had 2 network ID and 2 host ID ( because it’s class B )
While finding out usable hosts we see host ID like how many host ID’s are there according to class here it is class B
So we have 2 host ID’s which means = ( as 1 octet have 8 bites ) here we have (2 octets) 8+8 = 16 bits total , so , the the way to find the usable hosts will be
2^16 - 2 = 65,534 IP
( -2 because 1st IP is network IP and the last IP ( 255 ) is broadcast IP these are used for special person , ALWAYS PUT - 2 WHEN USABLE IP IS ASKED )
When total IP is asked we don’t have to put - 2 there.
Ques 2 - 11.200.200.200
Find network ID
Broadcast ID
Usable Host ID
Network ID - ( As this is from Class A ) - 11.0.0.0
Broadcast ID - 11.255.255.255
Usable Host ID - 2^24 - 2 = 16,777,214
Top comments (0)