If you are going to configure a network, then you need to know how to distribute it. To do this, you need to know the network and broadcast addresses of the network. Follow the steps below to find out how to compute these addresses if you have an IP address and subnet mask.
Steps
Method 1 of 3: For classful addressing
Step 1. For a classbased network, the total number of bits is 8
Or T_{b} = 8.
 The subnet mask can be 0, 128, 192, 224, 240, 248, 252, 254 and 255.
 The table below allows you to determine the "number of bits used for subnets" (n) for the corresponding subnet mask.
 The default subnet mask value is 255. It is not used to separate subnets.

Example:
Let the IP address be 210.1.1.100 and the subnet mask 255.255.255.224
Total number of bits T_{b} = 8 Number of bits used for subnets n = 3 (since the subnet mask is 224 and the corresponding "number of bits used for subnets" from the table above is 3)
Step 2. From the previous step, you have the "number of bits used for subnets" (n) and you know T_{b}.
Now you can find the "number of bits remaining for hosts" (m) equal to T_{b}  n, since the total number of bits is the sum of the bits for subnets and hosts T_{b} = m + n.
 Number of bits remaining for hosts = m = T_{b}  n = 8  3 = 5
Step 3. Now you need to calculate the "number of subnets" equal to 2, and "the value of the last bit used for the subnet mask", which is 2^{m}.
The number of hosts per subnet is 2^{m}  2.

Number of subnets = 2 = 2^{3} = 8
The last bit used for the subnet mask = Δ = 2^{m} = 2^{5} = 32
Step 4. Now you can find the previously calculated number of subnets by dividing them by the "last bit used for subnet mask" value or Δaddress
 The 8 subnets (as we calculated in the previous step) are shown above.
 Each of them has 32 addresses.
Step 5. Now you need to determine which network your IP address is on
The first address on this subnet will be the network address, and the last will be the broadcast address.
 Here we have selected the IP address 210.1.1.100. It is on the subnet 210.1.1.96  210.1.1.127 (see the previous table). Therefore, 210.1.1.96 is the network address, and 210.1.1.127 is the broadcast address for the selected IP address 210.1.1.100.
Method 2 of 3: For Classless Addressing (CIDR)
Step 1. In CIDR networks, the IP address is followed by a onebit subnet prefix, separated by a forward slash (/)
you will need to convert it to dotted quad format. Follow the steps below to do this.
 Write down the prefix in the format shown below.

 If the prefix is 27, write it down as 8 + 8 + 8 + 3.
 If it's 12, write it down as 8 + 4 + 0 + 0.
 By default, it is 32, which is written as 8 + 8 + 8 + 8.
 Convert the corresponding bits using the table below and write the value in fourpart format.
 Let our IP address be 170.1.0.0/26. Using the table above, you can write:
 The subnet mask can be 0, 128, 192, 224, 240, 248, 252, 254 and 255.
 The table below allows you to determine the "number of bits used for subnets" (n) for the corresponding subnet mask.
 The default subnet mask value is 255. It is not used to separate subnets.

From the previous step, our IP is 170.1.0.0 and our subnet mask is 255.255.255.192
Total number of bits = T_{b} = 8 Number of bits used for subnets = n = 2 (since the subnet mask is 192 and the corresponding "number of bits used for subnets" from the table above is 2).
 Number of bits remaining for hosts = m = T_{b}  n = 8  2 = 6

Number of subnets = 2 = 2^{2} = 4
The last bit used for the subnet mask = Δ = 2^{m} = 2^{6} = 64
 We get 4 subnets (as we calculated in the previous step)
 Each of them has 64 addresses.
 Here we have selected the IP address 170.1.0.0. It is on subnet 170.1.0.0  170.1.0.63 (see previous table). Therefore, 170.1.0.0 is the network address, and 170.1.0.63 is the broadcast address for the selected IP address 170.1.0.0.

IP Address = 100.5.150.34 and Subnet Mask = 255.255.240.0
Total number of bits = T_{b} = 8
Subnet mask 0 128 192 224 240 248 252 254 255 Number of bits used for subnets (n) 0 1 2 3 4 5 6 7 8 Number of bits used for subnetting for mask 240 = n_{1} = 4
(since the subnet mask is 240 and the corresponding "number of bits used for subnets" from the table above is 4)
Number of bits used for subnetting for mask 0 = n_{1} = 0
(since the subnet mask is 0 and the corresponding "number of bits used for subnets" from the table above is 0)
Number of bits remaining for hosts for mask 240 = m_{1} = T_{b}  n_{1} = 8  4 = 4
Number of bits remaining for hosts for mask 0 = m_{2} = T_{b}  n_{2} = 8  0 = 8
Number of subnets for a mask 240 = 2 ^{1} = 2^{4} = 16
Number of subnets for mask 0 = 2 ^{2} = 2^{0} = 1
The last bit used for the subnet mask for mask 240 = Δ_{1} = 2^{m1} = 2^{4} = 16
The value of the last bit used for the subnet mask for mask 0 = Δ_{2} = 2^{m2} = 2^{8} = 256
For subnet mask 240, the addresses will be split by 16, and for mask 0, there will be 256. Using the values of Δ_{1} and Δ_{2}, we get 16 subnets below
100.5.0.0  100.5.15.255 100.5.16.0  100.5.31.255 100.5.32.0  100.5.47.255 100.5.48.0  100.5.63.255 100.5.64.0  100.5.79.255 100.5.80.0  100.5.95.255 100.5.96.0  100.5.111.255 100.5.112.0  100.5.127.255 100.5.128.0  100.5.143.255 100.5.144.0  100.5.159.255 100.5.160.0  100.5.175.255 100.5.176.0  100.5.191.255 100.5.192.0  100.5.207.255 100.5.208.0  100.5.223.255 100.5.224.0  100.5.239.255 100.5.240.0  100.5.255.255 The IP address 100.5.150.34 belongs to the subnet 100.5.144.0  100.5.159.255, so 100.5.144.0 is the network address and 100.5.159.255 is the broadcast address
 IP address in the CIDR network = 200.222.5.100/9
 On CIDR networks, once you have converted the prefix to fourpart format, you can use the same method as for classbased networks.
 This method only works for IPv4 type networks and is not suitable for IPv6.
26  =  8  +  8  +  8  +  2  
255  .  255  .  255  .  192 
The IP address is now 170.1.0.0, and the subnet mask is in fourpart dotted format 255.255.255.192.
Step 2. Total number of bits = T_{b} = 8.
Step 3. From the previous step, you have the "number of bits used for subnets" (n) and you know T_{b}.
Now you can find the "number of bits remaining for hosts" (m) equal to T_{b}  n, since the total number of bits is the sum of the bits for subnets and hosts T_{b} = m + n.
Step 4. Now you need to calculate the "number of subnets" equal to 2, and "the value of the last bit used for the subnet mask", which is 2^{m}.
The number of hosts per subnet is 2^{m}  2.
Step 5. Now you can find the previously calculated number of subnets by dividing them by the "last bit used for subnet mask" value or Δaddress
Step 6. Now you need to determine which network your IP address is on
The first address on this subnet will be the network address, and the last will be the broadcast address.
Method 3 of 3: Using an online calculator
Step 1. Find the IP address and subnet mask
On a Windows computer, you can do this by entering the "ipconfig" command (without quotes) at a command prompt. The IP address will appear next to the IPv4 address, and the subnet mask can be found on the line below. On a Mac, you can find the IP address and subnet mask in System Preferences under Network. Step 2. Go to
You can use any browser, regardless of which system your computer is running. Step 3. In the "IP address" field, enter the appropriate values.
The website will try to automatically detect your network address. Make sure the values are correct. Otherwise, enter the correct address. Step 4. In the "Mask" field, enter the subnet mask.
Again, the site will automatically try to calculate these values. Make sure the data is correct. The subnet mask can be entered in either CIDR format (24) or fourpart dotted format (255.255.255.0). Step 5. Click Calculate.
It's a blue button opposite the Mask field. The network address will be listed below in the “Network” section, and the broadcast address will be listed in the “Broadcast” section.
Examples of
For class addressing
For Classless Addressing (CIDR)
9  =  8  +  1  +  0  +  0  
255  .  128  .  0  .  0 
IP Address = 200.222.5.100 and Subnet Mask = 255.128.0.0
Total number of bits = T_{b} = 8
Subnet mask  0  128  192  224  240  248  252  254  255 
Number of bits used for subnets (n)  0  1  2  3  4  5  6  7  8 
Number of bits used for subnetting for mask 128 = n_{1} = 1
(since the subnet mask is 128 and the corresponding "number of bits used for subnets" from the table above is 1)
Number of bits used for subnetting for mask 0 = n_{2} = n_{3} = 0
(since the subnet mask is 0 and the corresponding "number of bits used for subnets" from the table above is 0)
Number of bits remaining for hosts for mask 128 = m_{1} = T_{b}  n_{1} = 8  1 = 7
Number of bits remaining for hosts for mask 0 = m_{2} = m_{3} = T_{b}  n_{2} = T_{b}  n_{3} = 8  0 = 8
Number of subnets for mask 128 = 2 ^{1} = 2^{1} = 2
Number of subnets for mask 0 = 2 ^{2} = 2 ^{3} = 2^{0} = 1
The last bit used for the subnet mask for mask 128 = Δ_{1} = 2^{m1} = 2^{7} = 128
Number of hosts per subnet = 2^{m1}  2 = 2^{7}  2 = 126
The value of the last bit used for the subnet mask for mask 0 = Δ_{2} = Δ_{3} = 2^{m2} = 2^{m3} = 2^{8} = 256
Number of hosts per subnet with mask 0 = 2^{m2}  2 = 2^{m3}  2 = 2^{8}  2 = 254
For subnet mask 128, the addresses will be split by 128, and for mask 0 there will be 256. Using the values of Δ_{1} and Δ_{2}, we get 2 subnets below
200.0.0.0  200.127.255.255  200.128.0.0  200.255.255.255 